Advertisement
PA33Ak

ebat' ya vse esche top

Jan 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void Input(int arr[], int n)
  6. {
  7.  
  8.     cout << "\tenter array\n";
  9.     for (int i = 0; i < n; i++)
  10.     {
  11.         cin >> arr[i];
  12.     }
  13. }
  14. void Output(int arr[], int n)
  15. {
  16.  
  17.     int sum = 1;
  18.    
  19.     for (int i = 0; i < n; i++)
  20.     {
  21.         int r = arr[i];
  22.         int k = i;
  23.         if (!((i + 1) % 3))
  24.         {
  25.             sum = sum*r;
  26.         }
  27.     }
  28.     cout << "\n\tsum is:\n" << sum << endl;
  29. }
  30. int main()
  31. {
  32.     int n;
  33.     cout << "\tEnter n:\n";
  34.     cin >> n;
  35.     int m;
  36.     cout << "\tEnter n2:\n";
  37.     cin >> m;
  38.     int a[255];
  39.     int b[255];
  40.     cout << "\tArray 1:\n";
  41.     Input(a, n);
  42.     cout << "\tArray 2:\n";
  43.     Input(b, m);
  44.     cout << "\tElements of array 1 is: \n";
  45.     Output(a, n);
  46.     cout << "\tElements of array 2 is: \n";
  47.     Output(b, m);
  48.     system("pause");
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement