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


Please Help Members By Posting Answers For Below Questions

How can I invoke another program or command and trap its output?

878


Explain the red-black trees?

840


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3022


Explain how can I read and write comma-delimited text?

955


What are types of functions?

791


State the difference between x3 and x[3].

866


What is dynamic dispatch in c++?

799


Is c easy to learn?

764


what is reason of your company position's in india no. 1.

1993


How do you print an address?

1006


What is the purpose of the statement: strcat (S2, S1)?

874


Can true be a variable name in c?

776


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....

1748


What is zero based addressing?

948


How can you return multiple values from a function?

864