Last active
February 27, 2016 03:30
-
-
Save TheoKlein/ded78020d5ed843e1cf7 to your computer and use it in GitHub Desktop.
ZeroJudge_a006_C
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 (){ | |
| int a,b,c; | |
| int x = 0, y = 0; | |
| while(scanf("%d%d%d",&a,&b,&c)!= EOF){ | |
| if (b*b-(4*a*c) > 0){ | |
| x = ((-b) + sqrt(b*b-(4*a*c)))/(2*a); | |
| y = ((-b) - sqrt(b*b-(4*a*c)))/(2*a); | |
| printf("Two different roots x1=%d , x2=%d\n",x,y); | |
| } | |
| else if (b*b-(4*a*c) == 0){ | |
| x = ((-b) + sqrt(b*b-(4*a*c)))/(2*a); | |
| printf("Two same roots x=%d\n",x); | |
| }else | |
| printf("No real root\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment