Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fun main(args: Array<String>) {
var OK = 'Y'
do {
print("Nhap a = ")
var a = readLine()!!.toInt()
print("Nhap b = ")
var b = readLine()!!.toInt()
if(a==0)
print("Phuong trinh ${a}x + $b = 0 vo nghiem")
else {
var x:Double = -b/(a*1.0)
var nghiem = String.format("%.2f", x)
print("Phuong trinh ${a}x + $b = 0 co nghiem x = $nghiem")
}
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
You can’t perform that action at this time.