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 / chandan verma
#include<stdio.h>
#include<conio.h>
void main()
{
int n,tmp,rem,sum=0;
printf("enter a number");
scanf("%d",&n);
tmp=n;
while(n!=0)
{
rem=n%10;
sum+=rem*rem*rem;
n=n/10;
}
if(tmp==sum)
printf("%d is a strong no",tmp);
else
printf("%d is not a strong no",tmp);
getch();
}
printf(
Is This Answer Correct ? | 20 Yes | 31 No |
Post New Answer View All Answers
What are the functions to open and close file in c language?
what are the different storage classes in c?
Does c have function or method?
What are the modifiers available in c programming language?
What is extern variable in c with example?
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
How does selection sort work in c?
What is an lvalue?
What is the difference between malloc() and calloc() function in c language?
what do you mean by enumeration constant?
Explain what is wrong with this program statement?
What is a global variable in c?
What are volatile variables in c?
what are the advantages of a macro over a function?
What is the -> in c?