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


Please Help Members By Posting Answers For Below Questions

What are the functions to open and close file in c language?

733


what are the different storage classes in c?

667


Does c have function or method?

596


What are the modifiers available in c programming language?

745


What is extern variable in c with example?

544






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);

649


How does selection sort work in c?

629


What is an lvalue?

638


What is the difference between malloc() and calloc() function in c language?

608


what do you mean by enumeration constant?

601


Explain what is wrong with this program statement?

626


What is a global variable in c?

594


What are volatile variables in c?

525


what are the advantages of a macro over a function?

650


What is the -> in c?

591