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 is volatile, register definition in C
Explain how can you determine the size of an allocated portion of memory?
Explain about the functions strcat() and strcmp()?
Explain how does free() know explain how much memory to release?
Explain about the constants which help in debugging?
How do I send escape sequences to control a terminal or other device?
What is gets() function?
can any one tel me wt is the question pattern for NIC exam
Explain how do you generate random numbers in c?
Explain the use of #pragma exit?
What are the uses of a pointer?
What is the scope of an external variable in c?
What are the advantages of external class?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
What is the difference between functions getch() and getche()?