Advertisement
Andites

1.2 нормальное распределение

Sep 5th, 2022
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main(){
  5.     int a;
  6.     int b[10];
  7.      for(int i=0;i<11;i++){
  8.         b[i]=0;
  9.     }
  10.     for(int i=0;i<10000;i++){
  11.     a=(rand()%11+rand()%11+rand()%11+rand()%11+rand()%11+rand()%11)/6;
  12.     if (a==0){
  13.         b[0]=b[0]+1;
  14.     }
  15.     if (a==1){
  16.         b[1]=b[1]+1;
  17.     }
  18.     if (a==2){
  19.         b[2]=b[2]+1;
  20.     }
  21.     if (a==3){
  22.         b[3]=b[3]+1;
  23.     }
  24.     if (a==4){
  25.         b[4]=b[4]+1;
  26.     }
  27.     if (a==5){
  28.         b[5]=b[5]+1;
  29.     }
  30.     if (a==6){
  31.         b[6]=b[6]+1;
  32.     }
  33.     if (a==7){
  34.         b[7]=b[7]+1;
  35.     }
  36.     if (a==8){
  37.         b[8]=b[8]+1;
  38.     }
  39.     if (a==9){
  40.         b[9]=b[9]+1;
  41.     }
  42.     if (a==10){
  43.         b[10]=b[10]+1;
  44.     }
  45.     }
  46.     for(int i=0;i<11;i++){
  47.         cout << i <<" = " <<b[i]<< endl;
  48.         }
  49.     }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement