Created
November 5, 2016 17:38
-
-
Save Hajto/a37ad999ef5309aff7c5627df7319bfb to your computer and use it in GitHub Desktop.
This file contains hidden or 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<stdio.h> | |
#include<math.h> | |
int main() { | |
//Serio kurwa? Wiesz ze nie musisz uzywać jednoliterowych zmiennych? Wiesz ze mozesz napisac x_1, albo pierwszy_pierwiastek? | |
double a, b, c, d, x, z, p, q; | |
do { | |
printf("Podaj wartosc a: \n "); | |
scanf("%lf", & a); | |
printf("Podaj wartosc b: \n"); | |
scanf("%lf", & b); | |
printf("Podaj wartosc c: \n"); | |
scanf("%lf", & c); | |
printf("----------------------------------------\n"); | |
d = (b * b - (4 * a * c)); | |
x = ((-c) / b); | |
if (a == 0) | |
if (b == 0) | |
if (c == 0) printf(""); | |
else printf("sprzecznosc \n"); | |
else printf("x= %lf \n", x); | |
else { | |
if (d < 0) printf("Funkcja nie ma miejsc zerowych \n"); | |
else | |
if (d == 0) { | |
x = (-b) / (2 * a); | |
printf("Miejscem zerowym jest : %lf", x); | |
} else { | |
p = (-b) / (2 * a); | |
q = sqrt(d) / (2 * a); | |
x = p - q; | |
z = p + q; | |
printf("Pierwiastki wynosza : %lf i %lf ", x, z); | |
} | |
} | |
} while(a != 0 || b != 0 || c != 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment