Skip to content

Instantly share code, notes, and snippets.

@nelvson
Last active January 28, 2018 12:05
Show Gist options
  • Save nelvson/b69c53db92ca2392dd83de4f3d23a0cc to your computer and use it in GitHub Desktop.
Save nelvson/b69c53db92ca2392dd83de4f3d23a0cc to your computer and use it in GitHub Desktop.
Solusi Week 1
import java.util.Scanner;
public class Week1 {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.printf("Masukkan tanggal lahir, bulan lahir, dan tahun lahir\n");
System.out.printf("Setiap variabel dipisah dengan spasi\nInput : ");
short tanggalLahir = reader.nextByte();
byte bulanLahir = reader.nextByte();
byte tahunLahir = reader.nextByte();
System.out.printf("Output tanggal lahir : %d\n", tanggalLahir);
System.out.printf("Output bulan lahir : %d\n",bulanLahir);
System.out.printf("Output tahun lahir : %d\n",tahunLahir);
}
}
import java.util.Scanner;
public class Week1 {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.printf("Masukkan jumlah karyawan : ");
short jumlahKaryawan = reader.nextShort();
System.out.printf("Jumlah karyawan perusahaan Stark : %d\n", jumlahKaryawan);
}
}
import java.util.Scanner;
public class Week1 {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.printf("Masukkan radius dari lingkaran\n");
short radius = reader.nextByte();
final double pi = 3.14;
System.out.printf("Input radius : %d\n", radius);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment