Kartesius Matematika?Gas Teruuuuzzz…..

Kalau anda jago maupun ahli matematika, pasti tau dong apa itu ‘kartesius’..dan bila dimasukan dalam program GUI pasti akan terlihat berbeda.Jika bingung, program berikut bisa dijadikan sumber solusi.Ya…hitung-hitung belajar dan berbagi bersama…monggooo nggihh…

Listing:
import java.util.Scanner;
public class kartesius {
public static void main (String [] args)
{
Scanner input = new Scanner(System.in);
int[] a = new int[10];
int[] b = new int[10];
int anggotaA;
int anggotaB;
//masukkan banyaknya anggota a
do
{
System.out.print(“Masukkan Banyaknya Himpunan A (x 10);
System.out.println(“\n nilai harus \”x 10);
//masukkan banyaknya anggota b
do
{
System.out.print(“Masukkan banyaknya Himpunan B (y 10);
System.out.println(“\n nilai harus \”y 10);
//masukkan elemen a
System.out.println(“\nMasukkan Elemen Anggota A”);
for(int i=0 ;i <= anggotaA -1 ; i++)
{
int z = i+1;
System.out.print("\nElemen ke-["+z+"]:");
a[i]=input.nextInt();
}

System.out.println("\n");

//masukkan elemen b
System.out.println("\nMasukkan Anggota B");
for(int w=0 ; w <= anggotaB -1 ; w++)
{
int L = w + 1;
System.out.print("\nElemen ke["+L+"]:");
b[w] = input.nextInt();
}
System.out.println("\n");

//hasil kartesius
System.out.println("====HASIL KARTESIUS====");
for(int i=0 ; i <= anggotaA -1 ; i++)
{
for(int w=0 ; w <= anggotaB -1 ; w++)
{
System.out.print("("+a[i]+","+b[w]+")");
}
}
System.out.println("\n");
}
}

About halojack

i'm a simple guy

2 responses to “Kartesius Matematika?Gas Teruuuuzzz…..

  1. sekalian donk kaka logikanya

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: