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
public static void main(String[] args) { | |
Scanner scanner = new Scanner( System.in ); | |
char OK = 'Y'; | |
int a,b; | |
double x; | |
do | |
{ | |
System.out.print("Nhap a = "); | |
a = Integer.parseInt(scanner.nextLine() ); | |
System.out.print("Nhap b = "); |
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
static void Main(string[] args) | |
{ | |
char OK = 'Y'; | |
int a, b; | |
double x; | |
do | |
{ | |
Console.WriteLine("Nhap a = "); | |
a = int.Parse(Console.ReadLine()); | |
Console.WriteLine("Nhap b = "); |
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
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() |
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
fun main(args: Array<String>) { | |
print("Nhap so he thap phan:") | |
var number = readLine()!!.toLong() | |
var binary = binary(number) | |
print("Dang nhi phan la: $binary") | |
} | |
fun binary( _number:Long):Long{ | |
// Function parameters in Kotlin are read-only val's inside the function, | |
// so _number here will always refer to the original object that was passed in. | |
// If you need to modify what it points to while your function is running, |
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
fun main(args: Array<String>) { | |
print("Nhap so thu nhat:") | |
var a = readLine()!!.toFloat() | |
print("Nhap so thu hai:") | |
var b = readLine()!!.toFloat() | |
var max = Max(a,b) | |
print("So lon nhat la: $max") | |
} | |
fun Max(a:Float,b:Float):Float{ | |
var max:Float = 0.0f |
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
fun main(args: Array<String>) { | |
var S = 0 | |
print("Nhap n = ") | |
var n = readLine()!!.toInt() | |
for(i in 1..n) | |
S=S+i | |
print("Tong la: $S") | |
} |
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
fun main(args: Array<String>) { | |
println("Nhap so thu nhat: ") | |
var num1 = readLine()!!.toInt() | |
println("Nhap so thu hai: ") | |
var num2 = readLine()!!.toInt() | |
var Total = num1 + num2 | |
println("Tong là: $Total") | |
} |
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
fun main(args: Array<String>) { | |
print("Hello World!") | |
} |
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
isTriangle = True | |
OK = 'Y' | |
while True: | |
a = float(raw_input("Nhap a=")) | |
b = float(raw_input("Nhap b=")) | |
c = float(raw_input("Nhap c=")) | |
if(a<=0 or b<=0 or c<=0): | |
isTriangle = False | |
if((a + b <= c) or (a + c <= b) or (b + c <= a)): | |
isTriangle = False |
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() ); |