Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class NestedFor
- {
- public static void main(String[]args)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Masukan angka");
- int n = input.nextInt();
- int i,j;
- for(i=1;i<=n;i++)
- {
- for(j=n-i;j>0;j--)
- {
- System.out.print(" ");
- }
- for(j=0;j<i;j++)
- {
- System.out.print("* ");
- }
- System.out.print("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment