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?

611


Do you know the purpose of 'register' keyword?

641


Sir i need notes for structure,functions,pointers in c language can you help me please

1943


Where define directive used?

603


Where register variables are stored in c?

547






Explain what is the difference between a free-standing and a hosted environment?

633


How would you use the functions fseek(), freed(), fwrite() and ftell()?

699


What are run-time errors?

598


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

631


What is the difference between char array and char pointer?

525


What is string constants?

657


What are the 5 types of organizational structures?

546


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

974


What is bss in c?

598


Explain low-order bytes.

622