🔥🔥 Project-1 🔥🔥 Random Guess Number 🔥🔥
🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
In this we are preparing the project in which the random number is generated and you have to guess the number and is you guess the number is less than it shows the number is less vise versa and if you give right answer it give that is is right and exact answer and you have to count the number of guess.
🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int number, guess, i = 1, temp = 0;
srand(time(0));
number = rand() % 100 + 1;
printf("The Number is: %d\n ", number);
do
{
printf("Guess the Number:");
scanf("%d", &guess);
if (guess == number)
{
printf("%d is right guess\n", guess);
break;
}
else if (guess <= number)
{
printf("%d guess is less than actual number\n", guess);
}
else if (guess >= number)
{
printf("%d guess is more than actual number\n", guess);
}
else
{
printf("Enter Value is incorrect\n");
}
i++;
} while (guess <= number || guess >= number);
printf("Number of turns you guess: %d\n", i);
return 0;
}
🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
Comments
Post a Comment