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?
Do you know the purpose of 'register' keyword?
Sir i need notes for structure,functions,pointers in c language can you help me please
Where define directive used?
Where register variables are stored in c?
Explain what is the difference between a free-standing and a hosted environment?
How would you use the functions fseek(), freed(), fwrite() and ftell()?
What are run-time errors?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
What is the difference between char array and char pointer?
What is string constants?
What are the 5 types of organizational structures?
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
What is bss in c?
Explain low-order bytes.