bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_1 / tuition-c / P035.c

P035.c (653B)


      1 /* WAP to input an int number and display the product of the successors
      2 of even digits of the number entered by user. */
      3 
      4 #include <stdio.h>
      5 #include <stdbool.h>
      6 int main()
      7 {
      8     int n, res = 1, temp;
      9     bool status = false;
     10     printf("Enter the number : ");
     11     scanf("%d", &n);
     12     temp = n;
     13     while (temp > 0)
     14     {
     15         if ((temp % 10) % 2 == 0)
     16         {
     17             res *= (temp % 10) + 1;
     18             status = true;
     19         }
     20         temp /= 10;
     21     }
     22     if (!status)
     23         printf("\nThere is no even digits.");
     24     else
     25         printf("\nThe product of the successors of even digits of the number %d is : %d", n, res);
     26     return 0;
     27 }