C Program to find a number is strong or not - c programs
//C Program to find a number is strong or not
//eg: 145 is a strong number
#include <stdio.h>
#include <conio.h>
main()
{
int t,x,s,r;
clrscr();
printf("enter any number");
scanf(%d",&x);
t=x;
s=0
while(x>0)
{
r=x%10;
s=s*fact(r);
x=x/10;
}
if(t==s)
printf("%d is a strong number",t);
else
printf("%d is not a strong number",t);
gertch();
}
#include <conio.h>
main()
{
int t,x,s,r;
clrscr();
printf("enter any number");
scanf(%d",&x);
t=x;
s=0
while(x>0)
{
r=x%10;
s=s*fact(r);
x=x/10;
}
if(t==s)
printf("%d is a strong number",t);
else
printf("%d is not a strong number",t);
gertch();
}
int fact(int a)
{
int f,g;
f=1;
for(g=a;g>0;g--)
f=f*g;
return(f);
}
{
int f,g;
f=1;
for(g=a;g>0;g--)
f=f*g;
return(f);
}
No comments:
Post a Comment