Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a = 0;
- int b = 0;
- int c = 0;
- float avg_a = 0;
- float avg_h = 0;
- int sum = 0;
- //TODO
- //Input check
- cout<<"Podaj pierwsza liczbe: ";
- cin>>a;
- cout<<"\nPodaj druga liczbe: ";
- cin>>b;
- cout<<"\nPodaj trzecia liczbe: ";
- cin>>c;
- sum = a+b+c;
- avg_a = (float)(a+b+c)/3;
- avg_h = 3.0/(1/a + 1/b + 1/c);
- cout<<"Suma liczb a,b,c wynosi: "<<sum;
- cout<<"\nSrednia arytmetyczna liczb a,b,c wynosi: "<<avg_a;
- cout<<"\nSrednia harmoniczna z liczb a,b,c wynosi: "<<avg_h;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement