Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
kvadratická rovnice
#include <stdio.h> #include <math.h> //obsahuje sqrt() int main() { double a = 0, b = 0, c = 0; printf("Zadejte koeficienty: \n"); scanf("%lf %lf %lf", &a, &b, &c); printf(" a = %lf\n b = %lf\n c = %lf\n", a, b, c); double d = b*b - 4*a*c; if(d > 0) { //realne koreny double sqrt_d = sqrt(d); double x1 = (-b + sqrt_d) / (2*a); double x2 = (-b - sqrt_d) / (2*a); printf("Koreny rovnice jsou:\n x1: %lf \n x2: %lf \n", x1, x2); } else if(d == 0) { //dvojnasobny koren double x = (-b + sqrt(d))/(2*a) ; printf("Dvojnasobny koren kvadraticke rovnice je:\n x: %lf \n", x); } else { //komplexni cast programu :) //komplexni koreny printf("Rovnice ma komplexni koreny\n"); double xr = -b/(2*a); double xi = sqrt(-d)/(2*a); printf("Koreny rovnice jsou:\n Koren 1:\n Realna cast: %lf \n Imaginarni cast: %lfi\n", xr, xi); printf("\n Koren 2:\n Realna cast: %lf \n Imaginarni cast: %lfi\n", xr, -xi); } return 0; } // (x + 1)(x + 4) // (x + 1)(x + 1) = x^2 + 2x + 1 // (x + (1-i))(x + (1+i) )= x^2 + 2x + 2 - vyjde -1+1i a -1-1i
run
|
edit
|
history
|
help
0
euklejduv algoritmus
tiskunti retezcu a zmena pismenke z malych an velke
inicializace struktury
TBod new
TQueue
try implicit return 0
test
pokus
struktury ++ vysvětlivky
Přestupný rok