#include <iostream>
#include <cmath> // Нужна для sqrt, pow и abs
using namespace std;
int main() {
int variant;
double a, b, x;
cin >> variant >> a >> b; // Вводим всё по очереди
if (variant == 1) {
if (a + b >= 0) {
x = sqrt(a + b) + 3 * a * b;
cout << "x = " << x;
} else {
cout << "Negalima a ir b suma turi buti >= 0";
}
}
else if (variant == 2) {
if (b != 0) {
x = a / b - 2 * b;
cout << "x = " << x;
} else {
cout << "Negalima b reiksme";
}
}
else if (variant == 3) {
if (a < 0 && b < 0) { // Проверка для случая дробной степени
cout << "Negalima a ir (arba) b reiksme";
} else {
x = abs(a) + pow(b, a);
cout << "x = " << x;
}
}
return 0;
}⚠️Content was pasted as plain text and auto-formatted as a code block. Use the Code Block button in the editor for proper formatting.