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
Answers were Sorted based on User's Feedback
Answer / krishna
#include<stdio.h>
#include<conio.h>
void main()
{
int n,n1.p=1;clrscr()printf("\n enter num");scanf("%d",&n);
while(n>0){ n1=n%10;p=p*n1;n=n/10;}printf("\n required answer is %d",p);
getch();
}
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / 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 |
Answer / 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 |
Answer / pavithra
jus use an array to store d i/p
nd multiply the array elements
Is This Answer Correct ? | 0 Yes | 3 No |
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
what is the importance of spanning tree?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
write a program that will read the temperature in Celsius and convert that into Fahrenheit.
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
Explain what are bus errors, memory faults, and core dumps?
what is the difference between entry control and exit control statement?
12 Answers Darbari Lal DAV Model School,
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
What is bubble sort in c?
How can I access memory located at a certain address?
What are the different types of storage classes in C?