Function

· OOP1
Penulis

-Program C#

Image

Hasilnya;

Image

-Program C++

Image

Hasilnya;

Image

-Program Java

package funtion;
import java.util.Scanner;
public class Main
{
private static int input()
{
Scanner input = new Scanner(System.in);
int data;
data = input.nextInt();
return data;
}
public static void penjumlahan(int a, int b)
{
int hasil;
hasil= a + b ;
System.out.println(“Hasil Penjumlahan dari “+a+” Dengan “+b+” = “+hasil);
}
public static void perkalian(int a,int b)
{
int hasil;
hasil=a * b;
System.out.println(“Hasil Perkalian dari “+a+” Dengan “+b+” = “+hasil);
}
public static void main(String[] args)
{
System.out.print(“Masukkan nilai 1 = “);
int a= input();
System.out.print(“Masukkan nilai 2 = “);
int b = input();
penjumlahan(a, b);
perkalian(a, b);
}
}

Hasilnya;

Image

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: