I want to make a simple program in which the rand() function generates a random number out of 1,2,3 and the user is asked to predict the number. if the user predicts the number correctly then he wins otherwise he looses.
Here's the program-
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int game;
    int i;
    int x;
    printf("enter the expected value(0,1,2)");
    scanf("%d\n",&x);
    for(i=0;i<1;i++){
        game=(rand()%2) + 1
        if(x==game){
            printf("you win!");
        }
        else{
            printf("you loose!");
        }
    } return 0;
}
 
     
     
     
     
    