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
What are pragmas and what are they good for?
What is a structure member in c?
What is the difference between ++a and a++?
Why we use break in c?
Explain the difference between the local variable and global variable in c?
difference between Low, Middle, High Level languages in c ?
Why is c called c?
Why header file is used in c?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
Explain do array subscripts always start with zero?
What is variable declaration and definition in c?
Why do some versions of toupper act strangely if given an upper-case letter?
When would you use a pointer to a function?
Explain how can you restore a redirected standard stream?
What is graph in c?