Factorial Number
Write a program to determine whether n is a factorial number or not.
A factorial number is a number that is a factorial of another number.
Input Format: Input consists of a single integer which corresponds to n.
Output Format: Output consists of a string - “yes” or “no”
Sample Input
1 6
Sample Output 1 yes
Sample Input 2
12
Sample Output 2 no
#include < stdio.h >
int main()
{
int n,i=1,s=1;
scanf("%d",&n);
while( n < =0 )
{
s=s*i;
i++;
if( s==1 )
break;
}
if( )
printf("yes");
else
printf("no");
return 0;
}
Write a program to determine whether n is a factorial number or not.
A factorial number is a number that is a factorial of another number.
Input Format: Input consists of a single integer which corresponds to n.
Output Format: Output consists of a string - “yes” or “no”
Sample Input
1 6
Sample Output 1 yes
Sample Input 2
12
Sample Output 2 no
#include < stdio.h >
int main()
{
int n,i=1,s=1;
scanf("%d",&n);
while( n < =0 )
{
s=s*i;
i++;
if( s==1 )
break;
}
if( )
printf("yes");
else
printf("no");
return 0;
}
No comments