Advertisement
Rehan_Rahman26

array problem 4

Sep 30th, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. //array problem 4
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n,av,sum=0;
  7.     cin >> n;
  8.     int ar[n];
  9.     for(int i=0; i<n; i++)
  10.     {
  11.         cin >> ar[i];
  12.         sum+=ar[i];
  13.     }
  14.     cout << "average of the array elements are " << sum/n << endl;
  15.  
  16.     return 0;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement