Facebook
From MD. Akibul Hasan Naieem, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 114
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6.   cout<<"Enter an input: ";
  7.   int n;
  8.   cin>>n;
  9.   int Array[100];
  10.  
  11.   int sum=0;
  12.   for(int i=0; i<n; i++)
  13.   {
  14.       cin>>Array[i];
  15.       sum=sum+Array[i];
  16.   }
  17.  
  18.   cout<<"Summation is : "<<sum<<endl;
  19.  
  20.   float ave;
  21.   ave=(float)sum/n;
  22.   cout<<"Average is: "<<ave;
  23. }