Facebook
From Naimur Rahman , 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 106
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.   int n;
  6.   int sum=0;
  7.   int Array[100];
  8.   cout<<"Enter an input: ";
  9.   cin>>n;
  10.  
  11.   for(int a=0; a<n; a++)
  12.   {
  13.      cin>> Array[a];
  14.      sum=sum+Array[a];
  15.   }
  16.  
  17.  cout<<"sum of these number is: "<<sum<<endl;
  18.  float average;
  19.  average=(float)sum/n;
  20.  cout<<average;
  21.     return 0;
  22. }