In this assignment, you need to code a simple guessing game using MIPS assembly language.
The game starts by randomly picking a number between 10-99 then asks the user to guess the
exact number. The user should guess a number and enter it. The program should tell the user if
the entered number is greater or less than the picked number. The game continues until the user
guesses the number correctly, at that point, a score indicating the number of trials it took the user
to guess the number should be printed on the screen.
This is code in C program
int input_value = 0;
int selected_values =0;
int score = 0;
int main() {
srand(time (null));
selected_value =rand()%90 +10
printf("I an Thinking of a number between 10-99. Can you guess what it is? \n");
while(input_value != selected_value){
scanf("%d",input_value);
if (input_value< selected_value && input_value <99 && inputvalue>10);
printf("\nNO, the number I am thinking of is higher than %i. Can you guess what it is ?"\n, input_value);
else if (input_value > selected_value && input_value <99 && inputvalue>10)
printf("\nNO, the number I am thinking of is lower than %i. Can you guess what it is ?\n",input_value);
else if ( inputvalue<=10);
printf("You number is too small ! choose another number")
else if (input_value>= 99)
printf("You number is too big! choose another number")
else{ printf("\n well done the answer is %i and your score is %i",input_value,score);
return 0;
}
score = score +1
}
return 0,
}