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