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


Please Help Members By Posting Answers For Below Questions

What is a loop?

554


What is array of pointers to string?

570


What is scope and lifetime of a variable in c?

576


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.

1529


How can I access an I o board directly?

623






How #define works?

616


hi any body pls give me company name interview conduct "c" language only

1667


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?

601


What is main return c?

519


What is the modulus operator?

736


What is difference between main and void main?

628


How to Throw some light on the splay trees?

621


Why use int main instead of void main?

597


Which one would you prefer - a macro or a function?

604


Define Array of pointers.

633