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 an array in c?
What is pointer and structure in c?
What is static function in c?
Write a Program to accept different goods with the number, price and date of purchase and display them
I need previous papers of CSC.......plz help out by posting them.......
Where static variables are stored in memory in c?
C program to find all possible outcomes of a dice?
What is the use of putchar function?
Why can’t constant values be used to define an array’s initial size?
How many keywords (reserve words) are in c?
What is the purpose of 'register' keyword in c language?
What is c programming structure?
How can I list all of the predefined identifiers?
What is a memory leak? How to avoid it?
What is the difference between #include and #include 'file' ?