Wednesday, 20 February 2013
Factorial using for loop
//Factorial
#include<stdio.h>
int main()
{
float f;
int a,b,fact=1,i;
printf("Enter the number :");
scanf("%d",&a);
for(i=2;i<=a;i++)
{
fact=fact*i;
}
printf("Factorial is: %d",fact);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment