Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- double a, b, c, delta, x, x1, x2;
- printf("Wprowadz wspolczynniki a, b oraz c: ");
- scanf("%lf %lf %lf",&a, &b, &c);
- if(a==0)
- {
- x = (c/b);
- printf("x = %lf \n", x);
- exit(0);
- }
- delta = b*b-4*a*c;
- printf("Delta wynosi: %lf \n", delta);
- if(delta > 0)
- {
- x1 = (-b+sqrt(delta))/(2*a);
- x2 = (-b-sqrt(delta))/(2*a);
- printf("x1 = %.2lf oraz x2 = %.2lf \n", x1, x2);
- }
- else if (delta == 0)
- {
- x1 = x2 = -b/(2*a);
- printf("x1 = x2 = %.2lf \n", x1);
- }
- else
- {
- printf("Brak rozwiazań w ciele liczb rzeczywistych.");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement