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 / rahul
#include <stdio.h>
#include <math.h>
main()
{
int num,rem,qot,prod;
printf("enter the number ");
scanf("%d",&num);
prod=1;
while((num/10)>0)
{
rem=num%10;
prod=prod*rem;
num=(num-rem)/10;
}
printf("product is %d",prod);
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What are run-time errors?
What is the difference between declaring a variable and defining a variable?
What is the basic structure of c?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
Is c is a high level language?
What is pragma c?
What is the purpose of scanf() and printf() functions?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Define circular linked list.
What is a pragma?
Tell us the use of fflush() function in c language?
given post order,in order construct the corresponding binary tree
What is c value paradox explain?
What are qualifiers?
explain what is fifo?