-
-
Save rkhang7/88ce56f52bfbd327e9e0aeb1ee0ea751 to your computer and use it in GitHub Desktop.
This file contains 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
// giai pt bac 2 | |
#include <stdio.h> | |
#include <math.h> | |
#include <conio.h> | |
int main(int argc, char *argv[]) | |
{ | |
int a,b,c,d; | |
printf("a=");scanf("%d",&a); | |
printf("b=");scanf("%d",&b); | |
printf("c=");scanf("%d",&c); | |
d=b*b-4*a*c; | |
if(a==0) | |
{ | |
if(b==0) | |
{ | |
if(c==0) printf("PT co vo so nghiem"); | |
else printf("PT vo nghiem"); | |
} | |
else printf("Pt co nghiem %f",1.0*(-c)/b); | |
} | |
else | |
{ | |
if(d>0) | |
{ | |
printf("PT co 2 nghiem la %f va %f",1.0*(-b+sqrt(d))/(2*a),1.0*(-b-sqrt(d))/(2*a)); | |
} | |
else if(d==0) printf("Pt co nghiem kep la %f",(1.0*(-b))/(2*a)); | |
else printf("PT vo nghiem "); | |
} | |
getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment