Programming C Tutorial
--------------------------------------------------------------------------------------
Friday, June 10, 2011
TO FIND FACTORIAL OF A NUMBER USING C PROGRAM
#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;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment