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 / mathew varghese

#include<stdio.h>
void main()
{
int x,y,z,sum=0,h=1,t;
int factorial (int g, int k);
printf("enter a value to check whether it is strong
number...\n");
scanf("%d",&x);
printf("\nthe entered value is:::: %d \n ",x);
t=x;
while(x>0)
{
y=x%10;
x=x/10;
z=factorial(y,h);
sum=sum+z;
}
if(sum==t)
{
printf("\n %d is a strong no:\n",t);
}
else
{
printf("\n %d is not a strong no:\n",t);
}
}
int factorial (int g, int k)
{
while(g>=1)
{
k=k*g;
g=g-1;
}
return k;
}

Is This Answer Correct ?    44 Yes 24 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the bubble sort algorithm.

639


what is the syallabus of computer science students in group- 1?

1837


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

1407


What is the difference between union and anonymous union?

834


Explain the difference between the local variable and global variable in c?

599






explain what is fifo?

631


Can you write the algorithm for Queue?

1547


What are structures and unions? State differencves between them.

614


Explain what is a program flowchart and explain how does it help in writing a program?

645


List out few of the applications that make use of Multilinked Structures?

1290


What is main () in c language?

591


C program to find all possible outcomes of a dice?

1853


What does struct node * mean?

595


What are disadvantages of C language.

643


What is the difference between array and structure in c?

566