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


Please Help Members By Posting Answers For Below Questions

Explain what is the concatenation operator?

617


If fflush wont work, what can I use to flush input?

602


What is the method to save data in stack data structure type?

600


What is a shell structure examples?

584


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

750






What is ## preprocessor operator in c?

607


How will you find a duplicate number in a array without negating the nos ?

1636


Do pointers store the address of value or the actual value of a variable?

602


What is the data segment that is followed by c?

600


How many levels of pointers can you have?

695


What is c language used for?

551


to find the closest pair

1816


How can I sort a linked list?

630


What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

720


Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?

659