Advertisement
MARSHAL327

Untitled

Apr 10th, 2020
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include <math.h>
  5. #define pi 3.1415
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     const int n = 4;
  11.     float arr[n], arr2[n], sum = 0;
  12.  
  13.     for (int i = 0; i < n; i++)
  14.     {
  15.         cin >> arr[i];
  16.     }
  17.  
  18.     for (int i = 0; i < n; i++)
  19.     {
  20.         arr2[i] = 1 - ( (arr[i] - 1) / 8 );
  21.     }
  22.  
  23.     for (int i = 0; i < n; i++)
  24.     {
  25.         cout << "C" << i << " = " << arr2[i] << endl;
  26.         sum += arr2[i];
  27.     }
  28.  
  29.     cout << "sum = " << sum << endl;
  30.  
  31.     for (int i = 0; i < n; i++)
  32.     {
  33.         cout << "B" << i << " = " << arr2[i] / sum << endl;
  34.     }
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement