Factorial Program in C
This code is very simple and easy to write Factorial Program in C
#include<stdio.h>#include<conio.h>void main(){int n,i,f;f=i=1;clrscr();printf("Enter a Number to Find Factorial: ");scanf("%d",&n);while(i<=n){f*=i;i++;}printf("The Factorial of %d is : %d",n,f);getch();}
Output
Enter a Number to Find Factorial: 5The Factorial of 5 is : 120
No comments:
Post a Comment