Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main(){
- int a;
- int b[10];
- for(int i=0;i<11;i++){
- b[i]=0;
- }
- for(int i=0;i<10000;i++){
- a=rand()%11;
- if (a==0){
- b[0]=b[0]+1;
- }
- if (a==1){
- b[1]=b[1]+1;
- }
- if (a==2){
- b[2]=b[2]+1;
- }
- if (a==3){
- b[3]=b[3]+1;
- }
- if (a==4){
- b[4]=b[4]+1;
- }
- if (a==5){
- b[5]=b[5]+1;
- }
- if (a==6){
- b[6]=b[6]+1;
- }
- if (a==7){
- b[7]=b[7]+1;
- }
- if (a==8){
- b[8]=b[8]+1;
- }
- if (a==9){
- b[9]=b[9]+1;
- }
- if (a==10){
- b[10]=b[10]+1;
- }
- }
- for(int i=0;i<11;i++){
- cout << i <<" = " <<b[i]<< endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement