← Back to Forum

factorial using while loop in c

Posted on December 6, 2024, 12:09 pm


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

//code to find factorial of a number
int num=10;
int fact=1;
while(num>=1)
{
fact = fact * num;
num--;

}
printf("%d",fact);
return 0;
}


Add a Reply


Replies (0)

No replies yet. Be the first to reply!