Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int OBWOD_TROJKATA(int a, int b, int c) {
- int o;
- o=a+b+c;
- if (a+b>c && a+c>b && b+c>a)
- return o;
- else return -1;
- }
- int main(){
- int ot=OBWOD_TROJKATA(2,4,6);
- if (ot==-1) cout<<"Nie da sie utworzyc trojakta"<<endl;
- else cout<<"Obwod trojkata wynosi: "<<ot<<endl;;
- ot=OBWOD_TROJKATA(1,3,3);
- if (ot==-1) cout<<"Nie da sie utworzyc trojakta"<<endl;
- else cout<<"Obwod trojkata wynosi: "<<ot<<endl;;
- ot=OBWOD_TROJKATA(2,5,11);
- if (ot==-1) cout<<"Nie da sie utworzyc trojakta"<<endl;
- else cout<<"Obwod trojkata wynosi: "<<ot<<endl;;
- ot=OBWOD_TROJKATA(3,4,5);
- if (ot==-1) cout<<"Nie da sie utworzyc trojakta"<<endl;
- else cout<<"Obwod trojkata wynosi: "<<ot<<endl;;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement