Skip to content

Instantly share code, notes, and snippets.

@TranNgocMinh
Created February 6, 2018 04:34
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/48d19e83bee9e8c4a41d45ef827e2fe1 to your computer and use it in GitHub Desktop.
Save TranNgocMinh/48d19e83bee9e8c4a41d45ef827e2fe1 to your computer and use it in GitHub Desktop.
fun main(args: Array<String>) {
var isTriangle = true
var OK = 'Y'
do {
print("Nhap a = ")
var a = readLine()!!.toFloat()
print("Nhap b = ")
var b = readLine()!!.toFloat()
print("Nhap c = ")
var c = readLine()!!.toFloat()
if (a <= 0 || b <= 0 || c <= 0)
isTriangle = false
if ((a + b <= c) || (a + c <= b) || (b + c <= a))
isTriangle = false
if (isTriangle)
print("Day la tam giac")
else
print("Day khong phai la tam giac")
isTriangle = true
print("Ban muon tiep tuc khong?(Y/N)")
OK = readLine()!!.first()
}while(OK != 'N')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment