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 is typedef?
How can I get random integers in a certain range?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
how many errors in c explain deply
When should the const modifier be used?
What is the explanation for cyclic nature of data types in c?
What are actual arguments?
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
What is a #include preprocessor?
Who invented b language?
What are the different types of control structures?
Where we use clrscr in c?
Explain how can I remove the trailing spaces from a string?
Find MAXIMUM of three distinct integers using a single C statement
What is difference between main and void main?