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

How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

1580


How are portions of a program disabled in demo versions?

739


What is the scope of local variable in c?

567


Mention four important string handling functions in c languages .

616


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2163






What is meant by recursion?

620


What is uint8 in c?

634


difference between native and cross compilers

1664


What are keywords c?

594


Differentiate between a structure and a union.

756


Tell me what are bitwise shift operators?

648


How do you define a string?

649


What are the different types of data structures in c?

592


What are the storage classes in C?

616


Sir i need notes for structure,functions,pointers in c language can you help me please

1939