Sabtu, 26 Maret 2011

Program For (Looping)

package pernyataanfor;

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
     Scanner input = new Scanner (System.in);
     int n, m;
     System.out.println("Masukan n");n=input.nextInt();
     n =input.nextInt();
     System.out.println("Masukan m");m=input.nextInt();
     m =input.nextInt();
     for (int i= 1;i<=m; i++)
     if  (i  %2= =1)
     System.out.println(i);
     else
     System.out.println(i+"*");
    }
}

0 komentar:

Posting Komentar