public class array
{
public static void main(String [] ar)
{int [] um={4,5,2,3};
String [] nm={"joko","Budi","Yeni","Nino"};
System.out.println("No Nama Umur");
for(int i=0 ; i<4;i++)
System.out.println((i+1)+" "+nm[i]+" "+um[i]);
...
bersatu kita teguh bercerai kita runtuh

Selasa, 10 Mei 2011
array 2 dimensi kamus
import java.util.Scanner;
public class array_2_dimensi
{public static void main (String[] args)
{ Scanner input=new Scanner(System.in);
String [][] kata={
{"one","satu"},{"cow","sapi"},{"run","lari"},{"red","merah"},{"man","orang"}
};
String katadicari;
System.out.print("Kata Yang Di Cari = ");
katadicari=input.nextLine();
int i,k;k=-1;
for (i=0;i<5;i++)
{
...
While
public class while2 {
public static void main(String[] args)
{
int i=3;
while (i<=18)
{
System.out.println(i+","+""); i+=3;
}
...
for
public class tugas1
{
public static void main(String[] args)
{
for(int i=2; i<=10; i+=2)
System.out.println(i+","+"");
...
Faktorial
import java.util.Scanner;
public class faktorial
{
public static void main(String[] args)
{
int f;
int n;
Scanner input=new Scanner(System.in);
System.out.print("masukkan nilai f: ");
f=input.nextInt();
System.out.print("masukkan nilai n: ");
n=input.nextInt();
...
Pembalik array
import java.util.Scanner;
public class array
{
public static void main(String [] ar)
{Scanner input=new Scanner (System.in);
{
int i;
int[] data=new int [5];
for(i=0; i<5; i++)
{
...
for +Faktorial
public class tugas1
{
public static void main(String[] args)
{
int f=0 ; int n=10;
for(int i=2; i<=n; i+=2)f+=i;
System.out.println(n+", ="+f);
...
bintang 4
public class tugas_bintang4 {
public static void main (String[] args){
int baris,m;
for (int i=1;i<=7;i++){
if (i<5){
for (int j=1;j<=4;j++){
...
bintang3
import javax.swing.*;
public class tugas_bintang2 {
public static void main (String[] args){
int baris;
baris=Integer.valueOf(JOptionPane.showInputDialog("Masukan banyak Bintang ?"));
for (int i=1;i<=baris;i++) {
...
Bintang2
import javax.swing.*;
public class tugas_bintang {
public static void main(String[] args){
int baris,x,y;
baris=Integer.valueOf(JOptionPane.showInputDialog("Masukkan Banyak Bintang ?"));
x=baris+1;
for (int i=1;i<=baris;i++){
for (int j=1;j<=baris;j++){
y=i+j;
if (x<=y)
...
BINTANG1 JAVA BY Heru Uchiha
/import javax.swing.*;
public class tugas_bintang1 {
public static void main (String[] args){
int x;
x=Integer.valueOf(JOptionPane.showInputDialog("Masukan banyak Bintang ?"));
for (int i=1;i<=x;i++) {
...
Langganan:
Postingan (Atom)