Advertisement
icatalin

Untitled

Dec 12th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int v[20],i,n,SA=0,c=0,nr=0;
  8. float MA;
  9. cout<<"n="; cin>>n;
  10. for (i=1;i<=n;i++)
  11. {
  12. cout <<"introduceti numere ";
  13. cin >> v[i];
  14. if ( i%2 == 1)
  15. {SA=SA+ v[i];
  16. nr=nr++;
  17. }
  18. }
  19. MA=SA/nr;
  20. cout<<"Media aritmetica este... "<<MA;
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement