JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
about 1 month ago0 views
👨‍💻Programming
#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.

← Back to timeline