Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package prak_402;
- import java.util.Scanner;
- public class Prak_402 {
- public static void main(String[] args) {
- Scanner masukan = new Scanner(System.in);
- int bil1, bil2, bil3;
- System.out.println("Program menjumlahkan 2 bilangan");
- System.out.println("");
- System.out.print("Masukkan bilangan 1 : ");
- bil1=masukan.nextInt();
- System.out.print("Masukkan bilangan 2 : ");
- bil2=masukan.nextInt();
- System.out.print("Masukkan bilangan 3 : ");
- bil3=masukan.nextInt();
- System.out.println("");
- System.out.println("jumlah bil1+bil2 : "+(jumlah(bil1,bil2)));
- System.out.println("jumlah bil2+bil3 : "+(jumlah(bil2,bil3)));
- System.out.println("jumlah bil1+bil3 : "+(jumlah(bil1,bil3)));
- }
- private static int jumlah(int a, int b){
- int hasil=a+b;
- return hasil;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement