Write an algorithm for a program that receives an integer as
input and outputs
the product of of its digits. E.g. 1234 = 24, 705 = 0
Answer Posted / rahul
#include <stdio.h>
#include <math.h>
main()
{
int num,rem,qot,prod;
printf("enter the number ");
scanf("%d",&num);
prod=1;
while((num/10)>0)
{
rem=num%10;
prod=prod*rem;
num=(num-rem)/10;
}
printf("product is %d",prod);
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is a loop?
What is array of pointers to string?
What is scope and lifetime of a variable in c?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
How can I access an I o board directly?
How #define works?
hi any body pls give me company name interview conduct "c" language only
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
What is main return c?
What is the modulus operator?
What is difference between main and void main?
How to Throw some light on the splay trees?
Why use int main instead of void main?
Which one would you prefer - a macro or a function?
Define Array of pointers.