Thursday, January 21, 2016

Factorial in C Programming

#include <stdio.h>

int main()
{
int n,factorial;
factorial=1;
printf("Enter your number: ");
scanf("%d",&n);
while(n>0){
factorial=factorial*n;
--n;

}
printf("Your factorial number is : %d",factorial);
return 0;
}

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)