Do-While Loops

I can't figure out how to get my program to loop back around if the user chooses Y.

#include <stdio.h>

int main()
{
// Variable Declarations
float num1, num2, result;
char sel;
char sel2;
char result2;

do
{
// Input: Getting 2 numbers
printf("Enter 2 numbers: ");
scanf("%f %f",&num1, &num2);

//Displaying the menu
printf("\nMenu:\n");
printf("A ----- Addition\n");
printf("S ----- Subtraction\n");

// Input: Getting the user's selection
printf("\nEnter the letter corresponding to the calculation to be performed: ");
scanf(" %c",&sel);

if(sel=='A' || sel=='a')
{
result = num1+num2;
printf("\nThe addition is: %.2f\n",result);
}
else if(sel=='S' || sel=='s')
{
result = num1-num2;
printf("\nThe subtraction is: %.2f\n",result);
}
else
{
printf("\nInvalid Choice\n");
}

printf("\nWould you like to perform another calculation?\nY for Yes, anything else for No: ");
scanf("%f\n",&sel2)

//doing the calculations
if(sel2=='Y' || sel=='y')
{
result2 = 'Y' || 'y';
}

}
while (sel2=='Y' || sel2=='y');


return 0;
}
closed account (967L1hU5)
I suggest a while loop, as in
while (int* == *)

or similar
Topic archived. No new replies allowed.