Jumat, 30 Desember 2011

tugas algoritma modul 10

public class UlangFor

{
public static void main(String args[])

{
int bil;

for(bil=2;bil<100;bil+=2)

System.out.println(bil);
}
}
NO.2 :
import java.util.Scanner;

public class UlangFor5

{
public static void main(String args[])

{
Scanner masuk=new Scanner(System.in);

int x,y,bil;

System.out.print("Masukkan bilangan:");

x = masuk.nextInt();

System.out.print("Masukkan bilangan:");
y = masuk.nextInt();
for(bil=x;bil<=y;bil++)

if(bil%2==1)

System.out.println(bil);
}
}

0 komentar:

Posting Komentar

Statistik

Translate

Blog Archive