Ronaldoztupang

Jawaban Live Coding 23-10-2019

Oct 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. Pengenalan Looping
  2.  
  3. import java.io.*;
  4. import java.util.*;
  5.  
  6. public class Solution {
  7.  
  8.     public static void main(String[] args) {
  9.         Scanner masuk = new Scanner(System.in);
  10.         int x = masuk.nextInt();
  11.         for(int j=1;j<=x;j++)
  12.         {
  13.             System.out.println(j);
  14.         }
  15.     }
  16. }
  17.  
  18. Pengenalan Nested Loop
  19.  
  20. import java.io.*;
  21. import java.util.*;
  22.  
  23. public class Solution {
  24.  
  25.     public static void main(String[] args) {
  26.         Scanner masuk = new Scanner(System.in);
  27.         int x = masuk.nextInt();
  28.         for(int j=1;j<=x;j++)
  29.         {
  30.             for(int i=1; i<=j; i++)
  31.             {
  32.                 System.out.print("*");
  33.             }
  34.             System.out.println();
  35.         }
  36.     }
  37. }
Add Comment
Please, Sign In to add comment