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
import java.util.Scanner; | |
public class Program { | |
public static void main(String[] args) { | |
float a,b; | |
Scanner scanner = new Scanner( System.in ); | |
System.out.print( "Nhap a = " ); | |
a = Float.parseFloat(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
def Max(a,b): | |
max = 0 | |
if a>b: | |
max=a | |
else: | |
max=b | |
return max | |
a = float(raw_input("Nhap so thu nhat:")) | |
b = float(raw_input("Nhap so thu hai:")) | |
print "So lon nhat la:",Max(a,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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
long number; | |
Console.WriteLine("Nhap so he thap phan: "); | |
number = long.Parse(Console.ReadLine()); | |
Console.WriteLine("Dang nhi phan la:" + binary(number)); | |
Console.ReadKey(); | |
} |
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
import java.util.Scanner; | |
public class Program { | |
public static void main(String[] args) { | |
long number; | |
Scanner scanner = new Scanner( System.in ); | |
System.out.print( "Nhap so he thap phan: " ); | |
number = Long.parseLong(scanner.nextLine() ); | |
System.out.println("Dang nhi phan la:" + binary(number)); |
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
def binary(number): | |
base = 1 | |
binary_val = 0 | |
while(number > 0): | |
rem = number%2 | |
binary_val = binary_val + rem*base | |
number = number/2 | |
base = base*10 | |
return binary_val | |
number = long(raw_input("Nhap so he thap phan:")) |
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
bool isTriangle = true; | |
char OK = 'Y'; | |
float a,b,c; | |
do | |
{ | |
Console.WriteLine("Nhap a = "); | |
a = float.Parse(Console.ReadLine()); | |
Console.WriteLine("Nhap b = "); | |
b = float.Parse(Console.ReadLine()); | |
Console.WriteLine("Nhap c = "); |
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() ); |
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
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
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") | |
} |