Advertisement
DorSen

Bilet 19

Jan 24th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. Билет 19
  2. #include <iostream> Задание 3
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n=0;
  8. double a[100],s=0,k=0;
  9. cout<<"*** Анализ роста учеников ***"<<endl;
  10. cout<<"Введите рост (см) и нажмите <Enter>."<<endl;
  11. cout<<"Для завершения введите О и нажмите <Enter>"<<endl;
  12. cout<<"->";
  13. cin>>a[n];
  14. while(a[n]!=0)
  15. {
  16. cout<<"->";
  17. s+=a[n];
  18. n++;
  19. cin>>a[n];
  20. }
  21. s=s/double(n);
  22.  
  23. for(int i=0;i<n;i++)
  24. if(a[i]>s) k++;
  25.  
  26. cout<<"Средний рост "<<s<<endl;
  27. cout<<"У "<<k<<" человек рост превышает средний."<<endl;
  28.  
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement