I am working on a dice rolling program that I need help with. This is what I've written so far:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
int main()
{
int i;
int rollDice;
int firInp;
int secInp;
printf("Enter the amount of faces you want your dice to have: ");
scanf("%d", &firInp);
printf("Enter the amount of throws you want: ");
scanf("%d", &secInp);
for(i = 0; i < secInp; i++){
rollDice = (rand()%firInp) + 1;
printf("%d \n", rollDice);
}
return 0;
}
for example for the following throws [1,5,5,5,5,3], 1 and 3 have a percentage of 16.6%. and 5 of 66.6% How do I print the occurrence percentage for the Dice throws?