Friday 24 July 2015

C Program - For Loop 9 (Factorial Number)

C Program - For Loop 9 (Factorial Number)



#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,fact=1;
clrscr();
printf("\nEnter the value :- ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
fact=fact*i;
}
printf("\nThe factorial value of %d :- %d ",n,fact);
getch();
}

Output :- 


Enter the value :-  5

The factorial value of 5 :- 120

Back to 'C Language Programs'

No comments:

Post a Comment