daily pastebin goal
48%
SHARE
TWEET

Untitled

ilyaDubovtsev Jun 13th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<locale>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int mass[100], col = 10, num = 5, a = 0, b = 0, c = 0;
  9.  
  10.     for (int i = 0; i < col; i++)
  11.     {
  12.         cout << "Enter mass[" << i << "] > ";
  13.         cin >> mass[i];
  14.     }
  15.  
  16.     cout << "-------------------" << endl;
  17.     cout << "Enter number > ";
  18.     cin >> num;
  19.     cout << "-------------------" << endl;
  20.  
  21.     for (int i = 1; i < col; i += 2)
  22.     {
  23.         a += mass[i];
  24.     }
  25.  
  26.     cout << "a = " << a << endl;
  27.  
  28.     for (int i = 0; i < col; i++)
  29.     {
  30.         if ((mass[i] % num) == 0)
  31.             b += mass[i];
  32.     }
  33.  
  34.     cout << "b = " << b << endl;
  35.  
  36.     for (int i = 0; i < col; i++)
  37.     {
  38.         if (mass[i] % a == 0 || mass[i] % b == 0)
  39.             c += mass[i];
  40.     }
  41.  
  42.     cout << "c = " << c << endl;
  43.     system("pause>>void");
  44.     return 0;
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top