My program is ignoring my scanf statement before the if statement that would take user input to close the program or to continue by adding new information(at the end of the while (1) inside of main).
int main (void)
{
while (1)
{
float weight = 0;
char animal , b;
printf("Zoo Food Calculator: \n\n");
printf("What is the animal type? \n [M]Mammal or [A]Amphibian or [R]Reptile: \n");
scanf("%c", &animal);
printf("What is the weight of the animal in pounds?:\n");
scanf("%f", &weight);
weight = round(weight);
printf("weight in pounds: %f\n", weight);
if (animal == 'M')
{
Mammals (weight) ;
printf("For this animal you'll need %f lbs of food a week!\n", Mammals(weight));
}
else if (animal == 'A')
{
Amphibians (weight) ;
printf("For this animal you'll need %f lbs of food a week!\n",
Amphibians(weight));
}
else
{
Reptiles (weight) ;
printf("For this animal you'll need %f lbs of food a
week!\n", Reptiles(weight));
}
printf("Do you want to input new information? Y/N \n");
scanf("%c", &b);
if (b == 'N' || b == 'n')
{
break;
}
}
return 0;
}