Skip to content

Instantly share code, notes, and snippets.

View TranNgocMinh's full-sized avatar

Ngoc Minh TranNgocMinh

View GitHub Profile
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 = " );
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)
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();
}
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));
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:"))
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 = ");
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() );
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
fun main(args: Array<String>) {
print("Hello World!")
}
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")
}