#include <stdio.h>
#include <stdlib.h>

int roll_dice(void) {
    return (rand() % 6) + 1;  // returns a value between 1 and 6
}

int main(void) {
    int sum, i;
    int frequency[13] = {0};  // Array to store the frequency of sums (2-12)

    // Simulate rolling two dice 100,000 times
    for (i = 0; i < 100000; i++) {
        int die1 = roll_dice();
        int die2 = roll_dice();
        sum = die1 + die2;
        frequency[sum]++;
    }

    // Output the results
    printf("Sum\tFrequency\n");
    for (i = 2; i <= 12; i++) {
        printf("%d\t%d\n", i, frequency[i]);
    }

    return 0;
}
