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
#!/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 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 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 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 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 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 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 |
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
#include <stdio.h> | |
#include <stdbool.h> | |
int main() | |
{ | |
int i; | |
bool is_even = false; | |
for ( i = 1 ; i<=100 ; i++ ) | |
if (is_even == 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
import java.util.Arrays; | |
import java.util.Random; | |
import java.io.*; | |
public class PrintRandomInteger { | |
public static void main(String[] args) throws IOException { | |
try { | |
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); | |
System.out.print("How many number(s) do you want to print: "); |
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
/* Aplikasi untuk menghitung 1 + 1/2 + 1/3 + 1/4 + 1/5 + ... + 1/N */ | |
#include<stdio.h> | |
int main() | |
{ | |
unsigned long long N; | |
/*read value of N*/ | |
printf("Masukan Jumlah N: "); |
NewerOlder