can you help me where is my mistake ?? please this is my homework last day:(
Code:
#include<stdio.h>
#include <stdlib.h>
int main(void){
int number1;
int numberofestimates;
number1= (1 + rand()%1000);
printf( "Enter your estimate, -1 to end: " );
scanf( "%d", &numberofestimates );
while (numberofestimates!=-1)
{
printf("I have a number between 1 and 1000.Can you guess my number?Please type your first guess.Enter your estimate, -1 to end");
fflush(stdout);
scanf("%d\n",&numberofestimates);
if (number1<numberofestimates)
{
printf("Too high. Try again.");
fflush(stdout);
scanf("%d\n",&numberofestimates);
break;
}
if (number1>numberofestimates)
{
printf("too low.try again.");
fflush(stdout);
scanf("%d\n",&numberofestimates);
break;
}
if (number1==numberofestimates)
{
printf("Excellent! You guessed the number! ");
printf("do you want to play again please write a new guess ");
break;
}
}
return 0;
}