Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- double a,b,c,d,e,srednia,naj;
- cout<<"podaj 5 liczby";
- cin>>a>>b>>c>>d>>e;
- srednia=(a+b+c+d+e)/5;
- naj=fabs(srednia-a );
- if((fabs(srednia-b ))<naj)
- naj=b;
- if((fabs(srednia-c ))<naj)
- naj=c;
- if((fabs(srednia-d ))<naj)
- naj=d;
- if((fabs(srednia-e ))<naj)
- naj=e;
- cout<<srednia;
- cout<<"najblizej jest "<<naj;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement