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 / abhisekh_banerjee
/* To get an number as input and add the digits of that number*/
#include<stdio.h>
#include<conio.h>
int main(void)
{
int a,b,c=1,i;
clrscr();
printf("Enter the number : ");
scanf("%d",&a);
for(i=0;a>0;i++)
{
b=a%10;
a=a/10;
c=c*b;
}
printf("\n%d",c);
return 0;
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How can I invoke another program or command and trap its output?
Explain the red-black trees?
write a c program to calculate sum of digits till it reduces to a single digit using recursion
Explain how can I read and write comma-delimited text?
What are types of functions?
State the difference between x3 and x[3].
What is dynamic dispatch in c++?
Is c easy to learn?
what is reason of your company position's in india no. 1.
How do you print an address?
What is the purpose of the statement: strcat (S2, S1)?
Can true be a variable name in c?
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
What is zero based addressing?
How can you return multiple values from a function?