i added some comments and tidied up your indentation
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main (void)
{
int guess; // init to 0
int play_again; // set this as char !!!!!!
int r_num;
srand (time (NULL));
r_num = (999-100)+1; // 100 is probably too big, your user would get very bored. - try 10!
play_again=0; //this should be a char and initialised to 'n' or some meaningful value
do
{
printf("Hey am thinkin of a number!! Wanna guess?? ;) \n");
scanf("%d\n", &guess);
guess=0; //pointless, you have just asked the user for a value and then scrubbed it out with a 0 immediately
do
{
if (guess != r_num)
{
printf("Wrong answer!!\n");
}
else
{
printf("Correct answer!!\n"); // move this outside this loop, else statement not neccesary - that would be my preference
}
guess++; // why this ??? - has no meaning in the context, is not required, plus it is supposed to hold your user input.
}
while (r_num != guess);
printf("The correct answer is %d\n", rand () % r_num + 100); //why dont you output guess here? since the user got it right?
printf("Do you wish to play again?? (Y/N)");
scanf("%c", &play_again); //here you are asking the user for a value, then immediately making it 0 below ??????
play_again++; //this makes no sense either - it is supposed to be your user inut char and should not be touched
} // until the condition in while loop can evaluate it
while (play_again== 'y'||play_again=='Y');
return 0;
}