← Back to Forum

factorial using for loop in c

Posted on December 6, 2024, 12:09 pm


#include<stdio.h>
int main(){

int num=10;
int fact=1;
int i;

for(i=1; i<=num; i++){

fact = fact*i;
}
printf("%d",fact);


return 0;
}


Add a Reply


Replies (0)

No replies yet. Be the first to reply!