├── README.md └── code.txt /README.md: -------------------------------------------------------------------------------- 1 | ## Guess-the-number 2 | Let's set up a guessing game where a number is chosen within a certain range, and you have to guess it within a specified number of attempts. Yoy will start by guessing a number, and based on the feedback (whether it's too high or too low), you will adjust my subsequent guesses until either you guess the correct number or exhaust all attempts. 3 | -------------------------------------------------------------------------------- /code.txt: -------------------------------------------------------------------------------- 1 | // it is goin to be a fun.we will write a programe that generates the random no and ask the players to guss it if thr gusse is higher than the actual no ,the program will display "lower no please" similarly if the player guess is too low it display"higher no please" when the user select the correct no the programe will dispaly no of gusess the player use toarrive at that number. 2 | #include 3 | #include //for random no 4 | #include //every time random no when u run the program otherwise it will give same no every time. 5 | 6 | int main() { 7 | int number,guess,nguess=1; 8 | srand(time(0));//every time different no 9 | number=rand()%100+1;//generates a no between 1 to 100 its a mathematics. 10 | // printf("the no is = %d\n",number); 11 | //keep running the program until it is guissed 12 | do{ 13 | printf("guess the no betwn 1 to 100\n"); 14 | scanf("%d",&guess); 15 | if(guess>number){ 16 | printf("lower no please\n"); 17 | 18 | } 19 | else if(guess