#include <iostream>
#include <math.h>
int main()
{
setlocale(LC_ALL, "Russian");
int a, b, c;
float D, x, x1, x2;
std::cin >> a;
std::cin >> b;
std::cin >> c;
D = pow(b, 2) - (4 * a * c);
if (D > 0) {
x1 = ((-1 / b) - sqrt(D)) / (2 * a);
x2 = ((-1 / b) + sqrt(D)) / (2 * a);
printf("x1= %f \n", x1);
printf("x2= %f", x2);
}
else {
printf("Нет корней");
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <math.h>
int main()
{
setlocale(LC_ALL, "Russian");
int a, b, c;
float D, x, x1, x2;
std::cin >> a;
std::cin >> b;
std::cin >> c;
D = pow(b, 2) - (4 * a * c);
if (D > 0) {
x1 = ((-1 / b) - sqrt(D)) / (2 * a);
x2 = ((-1 / b) + sqrt(D)) / (2 * a);
printf("x1= %f \n", x1);
printf("x2= %f", x2);
}
else {
printf("Нет корней");
}
}