Check whether a given number is strong or not C program
#include<stdio.h>
main()
{
int n,f,sum=0,temp,r,i;
scanf("%d",&n);
temp=n;
while(n>0)
{
f=1;
r=n%10;
for(i=1;i<=r;i++)
f=f*i;
sum=sum+f;
n=n/10;
}
if(sum == temp)
printf("strong");
else
printf("not strong");
}
Check whether a given number is spy number or not C program
#include<stdio.h>
main()
{
int n,f=1,sum=0,r,i;
scanf("%d",&n);
while(n>0)
{
r=n%10;
f=f*r;
sum=sum+r;
n=n/10;
}
if(sum == f)
printf("spy");
else
printf("not spy");
}
#include<stdio.h>
main()
{
int n,f,sum=0,temp,r,i;
scanf("%d",&n);
temp=n;
while(n>0)
{
f=1;
r=n%10;
for(i=1;i<=r;i++)
f=f*i;
sum=sum+f;
n=n/10;
}
if(sum == temp)
printf("strong");
else
printf("not strong");
}
Check whether a given number is spy number or not C program
#include<stdio.h>
main()
{
int n,f=1,sum=0,r,i;
scanf("%d",&n);
while(n>0)
{
r=n%10;
f=f*r;
sum=sum+r;
n=n/10;
}
if(sum == f)
printf("spy");
else
printf("not spy");
}