Friday, March 17, 2023

"find the factorial of any positive integer using for loop " in c programming .

 //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

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...