Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GPT bậc 2.
- #include<stdio.h>
- #include<conio.h>
- #include<math.h>
- void gpt(float a, float b, float c){
- float delta,x1,x2;
- if (a==0)
- if(b==0)
- if(c==0)
- printf("Ptrinh co vo so nghiem.");
- else
- printf("Phuong trinh vo nghiem.");
- else
- printf("x = %0.2f",c/b);
- else{
- delta = b*b-4*a*c;
- if (delta<0)
- printf("Phuong trinh vo nghiem.");
- else
- if(delta>0)
- printf("x1 = %0.2f x2 = %0.2f ",(-b+sqrt(delta))/(2*a),
- (-b-sqrt(delta))/(2*a));
- else
- printf("x = %0.2f ",(-b)/(2*a));
- }
- }
- int main(){
- gpt(1,5,6);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement