Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Pengenalan Looping
- import java.io.*;
- import java.util.*;
- public class Solution {
- public static void main(String[] args) {
- Scanner masuk = new Scanner(System.in);
- int x = masuk.nextInt();
- for(int j=1;j<=x;j++)
- {
- System.out.println(j);
- }
- }
- }
- Pengenalan Nested Loop
- import java.io.*;
- import java.util.*;
- public class Solution {
- public static void main(String[] args) {
- Scanner masuk = new Scanner(System.in);
- int x = masuk.nextInt();
- for(int j=1;j<=x;j++)
- {
- for(int i=1; i<=j; i++)
- {
- System.out.print("*");
- }
- System.out.println();
- }
- }
- }
Add Comment
Please, Sign In to add comment