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
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
Math,
1 month ago
English,
1 month ago
Computer Science,
3 months ago
Math,
9 months ago
Geography,
9 months ago