A C program for finding a Factorial of user entered number.
In order to copy this code move your cursor to upper right corner of the post a source button will appear click on it and copy the code.
#include<stdio.h>
#include<conio.h>
void main() {
int i,n,ans;
clrscr();
printf("\n Enter the number: ");
scanf("%d",&n);
ans=1;
for (i=n;i>=1;i--) {
ans=ans*i;
}
printf("\n The factorial of this number is %d",ans);
printf("\n\n Press any key to exit the program...");
getch();
}

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Void « Default
Life
Earth
Wind
Water
Fire
Light 