Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Билет 19
- #include <iostream> Задание 3
- using namespace std;
- int main()
- {
- int n=0;
- double a[100],s=0,k=0;
- cout<<"*** Анализ роста учеников ***"<<endl;
- cout<<"Введите рост (см) и нажмите <Enter>."<<endl;
- cout<<"Для завершения введите О и нажмите <Enter>"<<endl;
- cout<<"->";
- cin>>a[n];
- while(a[n]!=0)
- {
- cout<<"->";
- s+=a[n];
- n++;
- cin>>a[n];
- }
- s=s/double(n);
- for(int i=0;i<n;i++)
- if(a[i]>s) k++;
- cout<<"Средний рост "<<s<<endl;
- cout<<"У "<<k<<" человек рост превышает средний."<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement