1
Hello, I need to compare the random value of 2 dice thrown, and I would like to know how I can store the result of these numbers in the variables D1 and D2.
int d1, d2, n;
printf("Quantas vezes voce deseja jogar? ");
scanf("%d",&n);
for (int contador = 0; contador < n; contador++){
    printf("%d \n",rand() % 6);
    printf("%d \n",rand() & 6);
    if (d1 == d2){
        printf("Os dados deram iguais \n");
    } else if(d1 > d2){
        printf("D1 venceu \n");
    } else{
        printf("D2 venceu \n");
    }
}
						
To generate numbers with some degree of randomness it is convenient to initialize the seed with the function
srand.– anonimo