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 / venkat
void main()
{
int n,f=1,rem,x,res=0,i;
clrscr();
printf("enter a number");
scanf("%d",&n);
x=n;
for(;n>0;n=n/10)
{
rem=n%10;
f=1;
for(i=1;i<=rem;i++)
f=f*i;
res=res+f;
}
if(res==x)
printf("given number is a strong number");
else
printf("given number is not a strong number");
getch();
}
| Is This Answer Correct ? | 18 Yes | 6 No |
Post New Answer View All Answers
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
When is a void pointer used?
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
Write a program for Overriding.
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
Explain how can I manipulate strings of multibyte characters?
What are different types of variables in c?
What is pointer to pointer in c language?
How can I recover the file name given an open stream or file descriptor?
How can I access an I o board directly?
what do you mean by enumeration constant?
Not all reserved words are written in lowercase. TRUE or FALSE?
What is return type in c?
Explain what is the difference between null and nul?
hi any body pls give me company name interview conduct "c" language only