Advertisement
ULK

Лабораторная №6 (5.64)

ULK
Nov 30th, 2022
828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int i;
  8.     double sum1 = 0;
  9.     int k;
  10.     double sum2 = 0;
  11.     int t;
  12.    
  13.     for (i=1; i<=12; i++){
  14.     cout << "Enter the area of the " << i << " district in sq km: " << endl;
  15.     cin >> k;
  16.     sum1 += k;
  17.     }
  18.    
  19.     for (i=1; i<=12; i++){
  20.     cout << "Enter the number of people of the " << i << " district: " << endl;
  21.     cin >> t;
  22.     sum2 += t;
  23.     }
  24.    
  25.     double ratio = sum2/sum1;
  26.  
  27.     cout << "Average population density in the region: " << ratio ;
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement