Minggu, 12 November 2017

For Nested JAVA

import java.util.Scanner;
public class ForNested{
 public static void main (String [] args){
 Scanner p = new Scanner(System.in);
 int a,b,g;
 System.out.print("masukan angka  : ");
 g = p.nextInt();
 for (a=1; a<=g; a++)
  {
 for (b=g; b>=a; b-- )
  {
  System.out.print("*");
   }
  System.out.println("");
  }
 }
}

Tidak ada komentar:

Posting Komentar