Skip to content

Instantly share code, notes, and snippets.

@ilhamarrouf
Created December 9, 2018 13:38
Show Gist options
  • Save ilhamarrouf/9f1c2bb2c4b286858cf9fd7922fc9d34 to your computer and use it in GitHub Desktop.
Save ilhamarrouf/9f1c2bb2c4b286858cf9fd7922fc9d34 to your computer and use it in GitHub Desktop.
Introduction to Programming
import java.util.Scanner;
public class Number {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.print("Masukkan angka pertama: ");
long a = Integer.parseInt(reader.nextLine());
System.out.print("Masukkan angka kedua: ");
long b = Integer.parseInt(reader.nextLine());
System.out.println("Bilangan terbesar: " + Math.max(a, b));
System.out.println("Bilangan terkecil: " + Math.min(a, b));
System.out.println(a +"^" + b + " = " + (long) Math.pow(a, b));
System.out.println(a +"^2 = " + (long) Math.pow(a, 2));
System.out.println(b +"^2 = " + (long) Math.pow(b, 2));
reader.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment