Skip to content

Instantly share code, notes, and snippets.

@TranNgocMinh
Created February 5, 2018 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TranNgocMinh/658d2f19487bb541adfd2ee7c9db67c1 to your computer and use it in GitHub Desktop.
Save TranNgocMinh/658d2f19487bb541adfd2ee7c9db67c1 to your computer and use it in GitHub Desktop.
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