Here’s an idea for you to do this in your code:
char answer="y";
do
{
// ...
printf( "Want to play again (y/n)? " );
scanf( " %c", &answer );
// Mind ^ the space here to discard any
// previously read newline character
} while ( answer == 'y' );
3
solved C Programming Guessing Game