Skip to content

Instantly share code, notes, and snippets.

@sansob
Created November 12, 2022 04:09
Show Gist options
  • Save sansob/0d687822870425bb1b9b77506a009d2a to your computer and use it in GitHub Desktop.
Save sansob/0d687822870425bb1b9b77506a009d2a to your computer and use it in GitHub Desktop.
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Console.WriteLine("Nama Saya Siapa ya?");
// int adalah tipe data
// age = nama variabel
// 10 adalah nilai dari variable tersebut
int age = 10;
string ages = "10";
double ten = 10.0;
Console.WriteLine(age);
Console.WriteLine(age);
Console.WriteLine(ages);
int a = 1;
int b = 2;
//expected hasil 3
int c = a + b;
Console.WriteLine(c);
bool iniSabtu = true;
string minggu = "hari ini bukan minggu";
// perhitungan luas persegi panjang
// panjang * lebar
int panjang = 10;
int lebar = 5;
int luas = panjang * lebar;
Console.WriteLine(luas);
/// kasus baru
var panjangA = 10.5;
var panjangB = 10;
var tulisan = "Aku";
var hasil = panjangA + panjangB;
Console.WriteLine(hasil);
bool a = true;
bool b = false;
Console.WriteLine(a && b);
Console.WriteLine(a || b);
Console.WriteLine(!a);
int bulan = 7;
if(bulan == 11)
{
Console.WriteLine("Ini ada bulan November");
}
else if(bulan == 2)
{
Console.WriteLine("Ini adalah bulan Februari");
}
else
{
Console.WriteLine("Ini bulan desember");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment