Code:
#include<stdio.h>
main()
{
int x;
int r;
char response;
srand( time(NULL) );
do{
printf("I have a number between 1 and 10.\n");
printf("Can you guess my number?\n");
printf("Please type your first guess.\n");
scanf("%d", &x);
r = 1 + ( rand() % 10 );
if ( r == x ){
printf("Excellent! You guessed the number!\n");
printf("Would you like to play again (y or n)?\n");
}
else
while ( r != x ){
if ( r > x ){
printf("Too low. Try Again.\n");
}
if ( r < x ){
printf("Too high. Try Again. \n");
}
printf("Please type another guess.\n");
scanf("%d", &x);
}
printf("Excellent! You guessed the number!\n");
printf("Would you like to play again (y or n)?: \n");
scanf(" %c", &response);
}while ( response == 'y' );}
finally figured it out thanks quizah couldnt have done it without ur help