Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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

Write an algorithm for a program that receives an integer as input and outputs the product of of i..

#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

Write an algorithm for a program that receives an integer as input and outputs the product of of i..

#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

Write an algorithm for a program that receives an integer as input and outputs the product of of i..

/* 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

Write an algorithm for a program that receives an integer as input and outputs the product of of i..

jus use an array to store d i/p
nd multiply the array elements

 Is This Answer Correct ? 0 Yes 3 No

More C Interview Questions

Why doesnt that code work?

What is #pragma statements?

post new interiew question and aptitude test papers

What is function definition in c?

Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

What are the general description for loop statement and available loop types in c?

How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

What is the best way to comment out a section of code that contains comments?

Can we initialize extern variable in c?

Why use int main instead of void main?

Can you please explain the difference between syntax vs logical error?

main() {int a=200*200/100; printf("%d",a); }

Categories