What im trying is to input 'yes' to continue and reset all values or 'no' to exit the program but i have tried to figure it out but im having trouble please help.thanks
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
float num1,result;
char sym;
printf("Calculator Is ON\n");
do{
result=0.0;
printf("Result=%f\n", result);
fflush(stdin);
scanf("%c",&sym);
while((sym!='r') && (sym!='R'))
{
scanf(" %f",&num1);
switch(sym)
{
case'+':
{
result+=num1;
printf("Result = %f\n",result);
break;
}
case'-':
{
result-=num1;
printf("Result = %f\n",result);
break;
}
case'*':
{
result*=num1;
printf("Result = %f\n",result);
break;
}
case'/':
{
result/=num1;
printf("Result = %f\n",result);
break;
}
case'%':
printf(" %c is an unknown operation\nReenter, your last line:",sym);
break;
}
scanf(" %c",&sym);
}
printf("Final result=%f",result);
printf("\nAgain [y/n]\n");
}
while((result!='n') && (result!='N'));
fflush(stdin);
scanf(" %c",&sym);
return 0 ;
}