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 / amolraje lendave
#include<iostream.h>
#include<conio.h>
int main()
{
int j,t,n,r,s=0,i,f=1;
clrscr();
for(j=3;j<=1000;j++)
{
s=0;
n=j;
while(n>0)
{
f=1;
r=n%10;
for(i=1;i<=r;i++)
{
f=f*i;
}
s=s+f;
n=n/10;
}
if(j==s)
{
cout<<j<<endl;
}
else
continue;
}
getch();
return 0;
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain what is the concatenation operator?
If fflush wont work, what can I use to flush input?
What is the method to save data in stack data structure type?
What is a shell structure examples?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
What is ## preprocessor operator in c?
How will you find a duplicate number in a array without negating the nos ?
Do pointers store the address of value or the actual value of a variable?
What is the data segment that is followed by c?
How many levels of pointers can you have?
What is c language used for?
to find the closest pair
How can I sort a linked list?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?