Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- double harmonicAverage(double, double);
- int main()
- {
- double First, Second;
- for(;;)
- {
- std::cout << "Podaj dwie liczby, 0 zeby skonczyc.\n";
- std::cin >> First >> Second;
- if(First == 0 || Second == 0)
- break;
- std::cout << "Srednia harmoniczna tych liczb to " << harmonicAverage(First, Second) << ". \n";
- }
- std::cout << "Wpisano 0 lub litere, koniec programu. ";
- return 0;
- }
- double harmonicAverage(double x, double y)
- {
- double result = (2.0*x*y)/(x + y);
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment