//find the factorial of any positive integer using for loop
#include <stdio.h>
int main (){
int i,n,fact=1 ;
printf ("enter the value of n :");
scanf ("%i",&n);
for (i=n;i>=1;i--){
fact =fact*i;
}
printf ("the factorial of n is %i",fact );
return 0;
}
No comments:
Post a Comment