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 difference between %d and %i in c?
What is identifier in c?
What is main return c?
What is hashing in c?
What is a keyword?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What is c standard library?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
What is a lvalue
What are the characteristics of arrays in c?
Is c++ based on c?
What is difference between constant pointer and constant variable?
How can I run c program?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above