Facebook
From Nahian Alam Nafi- 210510, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 88
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n, i, sum=0;
  6.     float avg;
  7.     cout << "Enter arr element: ";
  8.     cin >> n;
  9.     int a[100];
  10.     for(i=0; i<=n; i++){
  11.         cout <<"Input value: ";
  12.         cin >> a[i];
  13.         sum = sum + a[i];
  14.     }
  15.    
  16.     avg= sum/i;
  17.     cout << "Sumation is: " << sum << endl;
  18.     cout << "Average is: " << avg << endl;
  19.  
  20.     return 0;
  21. }