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 / prasad

int fact(int);
void main()
{
int sum=0,n,f,temp;
clrscr();
printf("enter the numnber u want to check:");
scanf("%d",&n);
temp=n;
while(n>o)
{
n=n%10;
f=fact(n);
sum=sum+f;
n=n/10;
}
if(sum==temp)
{
printf("given num %d is strong number:");
else
printf("given num %d is not a strong number:");
}
getch();
}
int fact(int n)
{
if(n==0)
return(1);
else
return n*fact(n-1);
}

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I get random integers in a certain range?

608


When was c language developed?

691


How can you find the exact size of a data type in c?

591


what is a function method?give example?

1910


What is pointer in c?

731






What is function prototype?

604


How would you rename a function in C?

612


What are the advantages of union?

620


What is the meaning of typedef struct in c?

580


Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.

1581


How to declare pointer variables?

677


Describe dynamic data structure in c programming language?

596


What do you understand by friend-functions? How are they used?

637


How can I convert a number to a string?

601


What is modeling?

634