perulangan tadi 10 juni

perulangan tadi...
dengan algoritma yg berbeda..
pertama
[Spoiler] [pertama] :

//nomor 1
for (int i=1;i<=10;i++){
for (int j=1; j<=10; j++)
if (i * j == 10)
System.out.print(i * j +" ");
else
System.out.print(i * j +" ");
System.out.println("");
}

//nomor 2
for (int i=1;i<=10;i++){
for (int j=1; j<=10; j++)
if (i * j == 10)
System.out.print(i * j +" ");
else
System.out.print(i * j +" ");
System.out.println("");
}
kedua
[Spoiler] [kedua] :

// nomor 1
int n = 1;
do {
for (int i = 1; i<=10; i++)
System.out.print(i * n + " ");
n++;
System.out.println("");
}
while (n<=10);

// nomor 2

int n = 1;
do {
for (int i = 1; i<=n; i++)
System.out.print(i * n + " ");
n++;
System.out.println("");
}
while (n<=10);


intinya "mana-mana Tuhan panggil"... n mana yang lebih makan memori
 
 
...