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


Please Help Members By Posting Answers For Below Questions

Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

5782


What is the modulus operator?

725


What are the key features in c programming language?

600


Can a pointer be null?

551


How can I handle floating-point exceptions gracefully?

619






GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA

1420


The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

700


What is the significance of an algorithm to C programming?

584


What's the difference between constant char *p and char * constant p?

648


What are shell structures used for?

591


Can we change the value of constant variable in c?

564


When would you use a pointer to a function?

578


What is null pointer in c?

582


Why dont c comments nest?

608


What are near, far and huge pointers?

638