Institute Of Engineering And Technology Agra

Dr Br Ambedkar University

Simulation For Factorial Program

Program

#include<stdio.h>

void main()

{

int n, fact=1,i;

printf("Enter a Number :");

scanf("%d",&n);

for(i=n ; i>=1 ; i--)

{

fact = fact*i;

}

printf("Factorial of %d = %d",n,fact);

}

Output

Enter A Number :

n :

i :

Factorial :

Program Explaination