free c programming course
Showing posts with label
write a program to find the factorial of a number
.
Show all posts
Showing posts with label
write a program to find the factorial of a number
.
Show all posts
Sunday, 8 May 2011
write a program to find the factorial of a number
#include
<stdio.h>
int
main
(){
int
i=1,f=1,num;
printf("\nEnter a number:");
scanf("%d",&num);
while
(i<=num){
f=f*i;
i++;
}
printf("\nFactorial of %d is:%d",num,f);
return
0;
}
Older Posts
Home
Subscribe to:
Posts (Atom)