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
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
What are the advantages and disadvantages of a heap?
What is a structure member in c?
Write a C program in Fibonacci series.
What is restrict keyword in c?
Hai what is the different types of versions and their differences
What are the similarities between c and c++?
What is c standard library?
What is the c language function prototype?
What is the process to create increment and decrement stamen in c?
Explain what is a 'locale'?
How many header files are in c?
Is it possible to pass an entire structure to functions?
What is wild pointer in c?
Write a program to implement queue.