/when user enters 1,2 or 3, the program exits without scanning for the quantities inside the else if statements block how to scan inside a if or else if statment/
if (num==4)
{
printf("exiting");
goto end;
}
else
{
if (num=='1')
{
printf("enter the value of the first unit\n");
scanf("%f",&first);
second=first*kmstomiles;
printf("the value of the second unit is %f",second);
}
else if (num=='2')
{
printf("enter the value of the first unit\n");
scanf("%f",&first);
second=first*inchestofeet;
printf("the value of the second unit is %f",second);
}
else if (num=='3')
{
printf("enter the value of the first unit\n");
scanf("%f",&first);
second=first*cmtoinches;
printf("the value of the second unit is %f",second);
}
Aucun commentaire:
Enregistrer un commentaire