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 / rajesh kumar s
void main()
{
int n,t,f=1,s=0,num;
printf("enter the num \t:");
scanf("%d",&n);
num=n;
while(num)
{
t=num%10;
f=1;
while(t)
{
f=f*t;
t--;
}
s=s+f;
num=num/10;
}
if(n==s)
printf("%d is a strong number",n);
else
printf("%d is not a strong number",n);
}
| Is This Answer Correct ? | 83 Yes | 17 No |
Post New Answer View All Answers
What is pre-emptive data structure and explain it with example?
What type is sizeof?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
What is the use of typedef in structure in c?
What is a double c?
Do pointers need to be initialized?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
What is function what are the types of function?
I have seen function declarations that look like this
Explain what is a pragma?
What is the difference between scanf and fscanf?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
Describe the header file and its usage in c programming?
In C programming, what command or code can be used to determine if a number of odd or even?
What are Macros? What are its advantages and disadvantages?