/
fears
/
fear
Обзор
Документация
Войти
/
fears
/
fear
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
PR2
30 строк
813 B
fears
upload files
06 май 2025, 07:55
06 май 2025, 07:55
4a3b888
Код
Авторство
О чём код?
#include <stdio.h> #include <conio.h> #include <math.h> int main(void) { float a, b, c; float D, x1, x2, x; printf("\n\t Equation a*x^2 + b*x + c = 0\n"); printf("\n\t Enter the coefficient a: "); scanf_s("%f", &a); printf("\t Enter the coefficient b: "); scanf_s("%f", &b); printf("\t Enter the coefficient c: "); scanf_s("%f", &c); D = b*b - 4*a*c; if (D >= 0 && a != 0) { x1 = -b/(2*a) + (float)sqrt(D)/(2*a); x2 = -b/(2*a) - (float)sqrt(D)/(2*a); printf("\n\t The roots of the equation:\n\t x1 = %1.4f, x2 = %1.4f\n", x1, x2); } if (D < 0) printf("\n\t The roots of complex\n"); if (a == 0 && b != 0) { x = -c/b; printf("\n\t As a = %1.0f,\n\t the solution of the equation is: %1.4f\n", a, x); } printf("\n Press any key: "); _getch(); return 0; }