Computer Science, asked by sk8248276, 3 months ago

5. Write a program in C that accept the student registration number as input and
print the product of all digits of registration number as output

Answers

Answered by syed15aashir
0

Answer:

#include<stdio.h>

int main()

{

   int num, rem, prod = 1;

   printf("Enter your registration number: ");

   scanf("%d", &num);

   while(num != 0)

   {

       rem = num % 10; // get the last-digit

       prod *= rem; // calculate product of digits

       num /=  10;  // remove the last digit

   }

   printf("%d", prod);

   return 0;

}

Similar questions