#include <stdio.h>
#include <stdlib.h>
int main ()
{
//this code is for calculating factorial
int number = 0;
int factorial = 1;
int i = 0;
int z = 0;
char yes_or_no = '0';
while (number <= 0) //in case a negetive number is entered
{
printf("Please Enter A POSITIVE number: \n");
scanf("%d",&number);
if (number < 0)
{
printf("Invalid Input! \n");
}
}
for(i=1; i <= number; ++i)
{
factorial *= i;
}
printf("The Factorial of %d is %d \n",number,factorial);//printing result
printf("would you like to try again? press y for yes or any other key for
no \n"); //the long printf...
scanf("%c",&yes_or_no);
if (yes_or_no == 'y')
{
yes_or_no ='y';
}
else
{
yes_or_no = 'z';
}
return 0;
}
this code is for claulating factional more than one time in one run (as long as the user want to calculate!,i have two problems one is that the lines after the long printf are being skipped (the IF is being skiped and i dont know which loop to use and how to repeat the whoul process