PTB2-BT

Màu nền
Font chữ
Font size
Chiều cao dòng

import java.io.*;

import java.lang.Math;

class PTB2

{

public static void main(String[] args)throws IOException

{

BufferedReader in = new BufferedReader(new InputStreamReader (System.in));

int a,b,c,denta;

float x1,x2;

System.out.print("Nhap a: ");

a=Integer.parseInt(in.readLine());

System.out.print("Nhap b: ");

b=Integer.parseInt(in.readLine());

System.out.print("Nhap c: ");

c=Integer.parseInt(in.readLine());

denta=b*b-4*a*c;

if(denta>=0)

{

if(denta==0)

System.out.println("Phuong trinh co nghiem kep: x=");

else

{

System.out.println("Phuong trinh co hai nghiem phan biet:

");

x1=(-b)+(sqrt(denta))/(2*a);

System.out.println("x1= "+x1);

}

}

else

System.out.println("Phuong trinh vo nghiem");

}

}

Bạn đang đọc truyện trên: Truyen2U.Pro

#hieu