This file contains hidden or 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
| use std::io; | |
| fn main() { | |
| loop { | |
| println!("Enter number of rows : "); | |
| let mut rows; | |
| rows = String::new(); | |
| io::stdin().read_line(&mut rows).expect("Failed to read line"); | |
| let rows: u32 = match rows.trim().parse() { | |
| Ok(num) => num, |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| while True: | |
| try: | |
| rows = int(input("Enter number of rows: ")) | |
| break | |
| except ValueError: | |
| print("Please enter integer only! Try again...") | |
| for i in range(rows): |
This file contains hidden or 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
| /* Usage: Palindrome <YourWord> */ | |
| use std::env; | |
| fn main () { | |
| let args: Vec<String> = env::args().collect(); | |
| if args.len() > 1 { | |
| println!("Original Word is {}", args[1]); | |
| println!("That Words Contains {} characters", args[1].len()); | |
| print!("Let's spell it backwards: "); |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # Python script untuk mengkonversi detik ke menit dan jam | |
| try: | |
| n = int(input("Masukan Detik : ")) # minta detik yang ingin dikonversi | |
| if n < 0: | |
| print("Masukan angka positif saja!") # jika kurang dari nol detik | |
| else: | |
| print(n // 3600, "Jam") # floor division dengan 3600 | |
| print(n % 3600 // 60, "Menit") # modulus 3600 lalu floor division dengan 60 |
This file contains hidden or 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
| use std::io; | |
| fn program() { | |
| let mut harga; | |
| loop { | |
| println!("Masukan harga aset dalam Rupiah : "); | |
| harga = String::new(); | |
| io::stdin() | |
| .read_line(&mut harga) | |
| .expect("Failed to read line"); |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| while True: | |
| try: | |
| harga = float(input("Masukan Harga Aset Dalam Rupiah : ")) | |
| if (harga <= 0): | |
| print("Harga aset harus lebih besar dari nol!") | |
| continue | |
| else: | |
| break | |
| except: |
This file contains hidden or 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.Calendar; | |
| class MobilGanjilGenap { | |
| public static void main(String[] args) { | |
| int tahun = 2022; /* Set Tahun Disini */ | |
| Calendar c = Calendar.getInstance(); | |
| c.set(tahun, Calendar.JANUARY, 1); /* set kalender mulai di tanggal 1 Januari */ | |
| int genap = 0; /* Jumlah Hari Untuk Mobil Genap */ |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # Python script untuk menghitung jumlah hari dimana mobil ganjil dan mobil genap boleh keluar di kawasan ganjil-genap Jakarta | |
| # Dibikin oleh Aditya Suseno | |
| import calendar # kita mengimpor library yang sudah ada | |
| tahun = 2022 # ganti dengan tahun yang kamu inginkan | |
| c = calendar.TextCalendar(calendar.SUNDAY) # set bahwa hari pertama di tiap bulan adalah hari Minggu | |
| # mulai jumlah hari dengan nol | |
| genap = 0 |
This file contains hidden or 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 LightBulb { | |
| boolean state; | |
| public LightBulb() { | |
| state = false; | |
| } | |
| public void turnOn() { | |
| this.state = true; | |
| this.printState(); | |
| } | |
| public void turnOff() { |
This file contains hidden or 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
| user@machine:~/chia-blockchain$ sh install.sh | |
| apt-get is /usr/bin/apt-get | |
| Installing on Ubuntu 21.04 or newer. | |
| Hit:1 http://archive.ubuntu.com/ubuntu hirsute InRelease | |
| Hit:2 http://prerelease.keybase.io/deb stable InRelease | |
| Hit:3 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease | |
| Hit:4 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease | |
| Hit:5 http://archive.ubuntu.com/ubuntu hirsute-security InRelease | |
| Reading package lists... Done | |
| Reading package lists... Done |
NewerOlder