Skip to content

Instantly share code, notes, and snippets.

View TranNgocMinh's full-sized avatar

Ngoc Minh TranNgocMinh

View GitHub Profile
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")
}
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
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,
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()
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 = ");
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 = ");
while True:
a = int(raw_input("Nhap a="))
b = int(raw_input("Nhap b="))
if(a is 0):
print "Phuong trinh %dx + %d = 0 vo nghiem."%(a,b)
else:
x = -b/(a*1.0)
print "Phuong trinh %dx + %d = 0 co nghiem x = %.2f"%(a,b,x)
OK = raw_input("Ban co muon tiep tuc?(Y/N)")
if (OK is 'N'):
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 {
<html>
<head>
<title>First Mobile Example</title>
<meta name="viewport" content="width=device-width, initialscale=1">
<link rel="stylesheet" href="jquery.mobile-1.4.5.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page" id="homePage">
<html>
<head>
<title>Header and Footer Demo</title>
<meta name="viewport" content="width=device-width, initialscale=1">
<link rel="stylesheet" href="jquery.mobile-1.4.5.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery.mobile-1.4.5.min.js"></script>
<script>
$(document).bind("pageinit", function(){
// Patch to prevent overwriting <title></title>