Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1.b
- #include <math.h>
- #include <iostream>
- using namespace std;
- int main() {
- int top;
- int bottom;
- int height;
- cin >> top >> bottom >> height;
- if (top > bottom) {
- cout << "Нижнее оснавание должно быть больше верхнего" << endl;
- return 1;
- }
- if (top <= 0 || bottom <= 0 || height <= 0) {
- cout << "Длинна не может быть 0" << endl;
- return 1;
- }
- int bok = sqrt(pow(height, 2) + pow((bottom - top) / 2, 2));
- int p = top + bottom + bok * 2;
- cout << "Периметр: " << p;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement