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 is double pointer in c?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
What is the newline escape sequence?
Explain the red-black trees?
What is a floating point in c?
how to capitalise first letter of each word in a given string?
The difference between printf and fprintf is ?
List a few unconditional control statement in c.
What is the use of linkage in c language?
Is register a keyword in c?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
Do character constants represent numerical values?
What is function prototype in c language?
Can a void pointer point to a function?