forked from tarunsinghofficial/HacktoberFest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Strong.c
51 lines (25 loc) · 556 Bytes
/
Strong.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<stdio.h>
int main(void)
{
int num,i,fact,r,sum=0,temp;
printf("Please enter a number to find strong number");
scanf("%d",&num);
temp=num; //temp variable will not reflect the actual value of num.
while(num)
{
i=1,fact=1;
r=num%10;
while(i<=r)
{
fact=fact*i;
i++;
}
sum=sum+fact;
num=num/10;
}
if(sum==temp)
printf("\nThe number %d is a strong number",temp);
else
printf("\nThe number %d is not a strong number",temp);
return 0;
}