if
and else
have to be next to each other... you need to have curly brackets in there as such:
if (answer == 'y')
{
printf("Answer is %c\n", answer);
printf("Success!\n");
printf("Do you want to play again? Y or N: ");
}
else
break;
to do more than one statement in an if block.
If you want to check more than one condition, don't use an if
/else
but a if
/else if
like such:
if (answer == 'y')
{
printf("Answer is %c\n", answer);
printf("Success!\n");
printf("Do you want to play again? Y or N: ");
}
else if(answer == 'n')
break;