Every time I run this program it gives me the same values for the random numbers.
1. 6
2. 6
3. 5
4. 5
5. 6
6. 5
7. 1
8. 1
9. 5
10. 3
11. 6
12. 6
13. 2
14. 4
this always stays the same.
What am I doing wrong?
The code follows:
Code:
#include <stdio.h>
#include <stdlib.h>
main () {
int values [14];
int i,n;
int amount[7]={0};
for (i=0; i<14; i++){
values[i]=rand()%6+1;
n=i+1;
printf("%i. %i\n",n,values[i]);
if (values[i]==1){
amount[1]++;}
else if (values[i]==2){
amount[2]++;}
}
for (i=1; i<7; i++){
printf("%i\n",amount[i]);
}
system ("Pause");
}