Created
September 19, 2018 09:15
-
-
Save ukoloff/2ba54476f0c289dcb671f456a9fe0edc to your computer and use it in GitHub Desktop.
algo-1 created by ukoloff - https://repl.it/@ukoloff/algo-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
int main() { | |
std::cout << "Введите два числа:"; | |
int a, b; | |
std::cin >> a >> b; | |
std::cout << a << " + " << b << " = " << a + b << std::endl; | |
std::cout << a << " - " << b << " = " << a - b << std::endl; | |
std::cout << a << " * " << b << " = " << a * b << std::endl; | |
std::cout << a << " / " << b << " = " << a / 1.0 / b << std::endl; | |
std::cout << "Max = " << (a > b ? a : b) << std::endl; | |
std::cout << "Min = " << (a > b ? b : a) << std::endl; | |
int D = a * a - 4 * b; | |
if (D < 0) { | |
std::cout << "Нет корней" << std::endl; | |
} else if (0 == D) { | |
std::cout << "Один корень: " << -a / 2.0 << std::endl; | |
} else { | |
std::cout << "Два корня: " << | |
(-a + sqrt(D)) / 2 << " и " << | |
(-a - sqrt(D)) / 2 << std::endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment