Facebook
From Md Amir Hossen (210528), 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 111
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,sum;
  6. int p[100];
  7. cout<<"Enter number of input:";
  8. cin>>n;
  9. for(int i=0;i<n;i++){
  10.  
  11.     cin>>p[i];
  12.     sum=sum+p[i];
  13. }
  14. cout<<"sum of integers="&lt;&lt;sum&lt;&lt;endl;
  15. double avg;
  16. avg=(double)sum/n;
  17. cout&lt;&lt;"Average of the integers="<<avg<<endl;
  18. return 0;
  19. }