Note that there are some explanatory texts on larger screens.

plurals
  1. POAsterisk Histogram for random dice rolls of 3 dice
    text
    copied!<pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include &lt;string.h&gt; int main() { int i; int d1, d2, d3; int a[16]; srand(time(NULL)); for(i = 0; i &lt;= 15; i++) a[i] = 0; for(i = 0; i &lt; 1000; i = i + 1) { d1 = rand() % 6 + 1; d2 = rand() % 6 + 1; d3 = rand() % 6 + 1; ++a[d1 + d2 + d3 - 3]; } char asterisks[0x400]; memset(asterisks, '*', sizeof(asterisks)); for(i = 0; i &lt;= 15; i = i + 1) { printf("%3d - ", i+3); for(j=0;j&lt;a[i];j++) { printf("%c ",'*'); } printf("\n"); } return 0; } </code></pre> <p>Updated code.<br> The goal is to have an asterisk histogram judging the dice rolls of 3 dice rolled 1000 times. It is to count how many combinations of sums between 3 and 18. Histogram output should look like this: </p> <pre><code>Frequency of Results for 3d6 3 - * 4 - ** 5 - **** 6 - ******* 7 - ********* 8 - *********** 9 - ************ 10 - ************ 11 - ************* 12 - ********** 13 - ************* 14 - ******** 15 - ****** 16 - *** 17 - *** 18 - ** </code></pre> <p>This is my output as of now:</p> <pre><code>3 - * * 4 - * * * * * * * * * * * * * * * * * * * * 5 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 6 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * 7 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * 8 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * 9 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 10 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 11 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * 12 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * 13 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * 14 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * 15 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * 16 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 17 - * * * * * * * * * 18 - * * * * * * * * </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload