Created
February 5, 2018 06:25
-
-
Save TranNgocMinh/658d2f19487bb541adfd2ee7c9db67c1 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
Scanner scanner = new Scanner( System.in ); | |
boolean isTriangle = true; | |
char OK = 'Y'; | |
float a,b,c; | |
do | |
{ | |
System.out.print("Nhap a = "); | |
a = Float.parseFloat(scanner.nextLine() ); | |
System.out.print("Nhap b = "); | |
b = Float.parseFloat(scanner.nextLine() ); | |
System.out.print("Nhap c = "); | |
c = Float.parseFloat(scanner.nextLine() ); | |
if(a<=0 || b<=0 || c<=0) | |
isTriangle = false; | |
if((a + b <= c) || (a + c <= b) || (b + c <= a)) | |
isTriangle = false; | |
if(isTriangle) | |
System.out.print("Day la tam giac"); | |
else | |
System.out.print("Day khong phai la tam giac"); | |
isTriangle = true; | |
System.out.print("Ban muon tiep tuc khong?(Y/N)"); | |
OK = scanner.nextLine().charAt(0); | |
} while(OK != 'N'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment