C program to find the given number is perfect factorial of a integer

 PROGRAM TO FIND THE GIVEN NUMBER IS PERFECT FACTORIAL OF A INTEGER.

IF YOU GIVE A NUMBER IT WILL BE THE INTEGER WHICH IS FACTORIAL OF IT .MEANS INVERSE FACTORIAL.

EX:

Enter the number 

120

Output:

Factorial integer of given number is 

Ex2:

Enter the number 

100

Output:

Given number is not a perfect factorial.


PROGRAM:

#include<stdio.h>

int main()

{

int i=1,n,fact=1;

printed("enter the number") ;

scanf("%d",&n);

if(n==1) 

printf("the factorial numbers of 1 is 0 and 1");

else

{

while(i>0)

{

fact=fact*i;

if(fact==n)

{

printf("the factorial number of %d is %d",n,i);

break;

}

if(fact>n)

{

printf("given number %d is not a perfect factorial",n);

break;

}

i++;

}

}

return 0;

}


Click here to run the code



Click here to see previous program


                    LEARN WITH JAGADEESH                             

                      copyright© to jagadeesh




2 Comments

Post a Comment