int main()
{
// stating my primivative data types and variables
float num1,result;
char symbol, choice;
printf("Calculator Is ON\n");
do{
result=0.0; //assign 0.0 to result
printf("Result=%.1f\n", result);
scanf(" %c",&symbol);
while((symbol!='r') && (symbol!='R'))
{
scanf(" %f",&num1);
switch(symbol)
{
case'+':
result=result+num1;
printf("Result = %.1f\n",result);
break;
case'-':
result=result-num1;
printf("Result = %.1f\n",result);
break;
case'*':
result=result*num1;
printf("Result = %.1f\n",result);
break;
case'/':
result=result/num1;
printf("Result = %.1f\n",result);
break;
default:'%';
printf(" %c is an unknown operation\nReenter, your last line:",symbol);
break;
}
scanf(" %c",&symbol);
}
printf("Final result=%.1f",result);
printf("\nAgain [y/n]\n",choice);
scanf(" %c",&choice);
}
while((choice!='n') && (choice!='N'));
printf("End of Program");
return 0 ;
}
My question is when i enter r or R kicks me out of the do-while loop and then ask me if i want to continue then i press yes or no. My question is the logic behind the second while loop. If i press yes or y does it bring you all the way back to the start of the do while?