Advertisement
DawidKubiak

Zad.10

Mar 22nd, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int obw (int a, int b, int c)
  5. {
  6. if (a+b>c)
  7. {
  8.     return -1;
  9. }
  10. else
  11. {
  12.     return a+b+c;
  13. }
  14. }
  15. int main()
  16. {
  17.     int a,b,c;
  18.     cin >> a;
  19.     cin >> b;
  20.     cin >> c;
  21.     if (obw(a,b,c)==-1)
  22. {
  23.     cout << "Nie mozna utworzyc trojkata" << endl;
  24. }
  25. else
  26. {
  27.     cout << obw(a,b,c) << endl;
  28. }
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement