write a program to check whether a given integer is a strong
number or not?
[Hint:
145=1!+4!+5!
=1+24+120
=145]
Answer Posted / valli
int fact(int f)
{
if(f==1||f==0)
return 1;
else
return(f*fact(f-1));
}
main()
{
int n,i,j,s=0;
printf("enter the number");
scanf("%d",&n);
i=n;
while(n!=0)
{
j=n%10;
s=s+fact(j);
n=n/10;
}
if(i==s)
printf("strong number");
else
printf("not a strong number");
}
| Is This Answer Correct ? | 12 Yes | 8 No |
Post New Answer View All Answers
What is #include stdio h?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
How can a program be made to print the line number where an error occurs?
How will you write a code for accessing the length of an array without assigning it to another variable?
what is the difference between class and unio?
What is the most efficient way to store flag values?
What is difference between array and pointer in c?
What is the general form of a C program?
What is c programming structure?
Explain what is a program flowchart and explain how does it help in writing a program?
What does *p++ do? What does it point to?
Is c weakly typed?
What is the ANSI C Standard?
Who is the founder of c language?
What is structure packing in c?