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 do you mean by Recursion Function?
What is the difference between call by value and call by reference in c?
What does it mean when a pointer is used in an if statement?
What is exit() function?
How can I delete a file?
Can two or more operators such as and be combined in a single line of program code?
When can you use a pointer with a function?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What is meant by type casting?
How can a program be made to print the line number where an error occurs?
What is local and global variable in c?
How arrays can be passed to a user defined function
Can we declare variables anywhere in c?
What are the types of data types and explain?
What does %2f mean in c?