Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int a,b,c;
- float x1, x2;
- double d;
- printf("Input a: ");
- scanf("%d", &a);
- printf("Input b: ");
- scanf("%d", &b);
- printf("Input c: ");
- scanf("%d", &c);
- d = b*b-4*a*c;
- if (d >= 0)
- {
- if (d == 0)
- {
- x1 = (-1*b)/(2*a);
- printf("x1 = %f", x1);
- }
- else
- {
- x1 = (-1*b+sqrt(d))/(2*a);
- x2 = (-1*b-sqrt(d))/(2*a);
- printf("x1= %f x2= %f", x1, x2);
- }
- }
- else
- {
- printf("Net korney");
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement