Facebook
From Aninda_210520, 6 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 148
  1. #include<iostream>
  2. using namespace std;
  3. int main(){
  4. int array[100];
  5. cout<<"how many inputs do you want to enter?"<<endl;
  6. int input;
  7. cin>>input;
  8. int a;
  9. for(a=0; a&lt;input; a++)
  10. {cin&gt;&gt;array[a];
  11.  }
  12.  for(int b=0; b&lt;input; b++)
  13. { cout&lt;&lt;"Array["<<b<<"]=:"<<array[b]<<endl;
  14. }
  15. int c;
  16. float sum=0;
  17. for (c=0; c&lt;input; c++)
  18. { sum= sum+ array[c];
  19.  
  20.  }
  21. cout&lt;&lt;"sum of inputs =:"<<sum<<endl;
  22. float average;
  23. average=sum/input;
  24. cout<<"average of your inputs :"<<average<<endl;
  25.  
  26.   return 0;}