Advertisement
rotti321

Exemplu prg atestat

Mar 21st, 2022
646
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, a[20],i;
  8.     float media,suma=0;
  9.     cin>>n;
  10.     for(i=1;i<=n;i++)
  11.     {
  12.         cin>>a[i];
  13.         suma=suma + a[i];
  14.     }
  15.     media = suma/n;
  16.     cout<<"Media:"<<media<<endl;
  17.     cout<<"Numerele impare din sir:"<<endl;
  18.     for(i=1;i<=n;i++){
  19.         if(a[i]%2!=0){
  20.             cout<<a[i]<<" ";
  21.         }
  22.     }
  23.     return 0;
  24. }
  25.  
Advertisement
RAW Paste Data Copied
Advertisement