Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main {
  3.  
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner keyboard = new Scanner(System.in);
  7.  
  8.         int from = 1;
  9.         int to = 20;
  10.  
  11.  
  12.         for (int n = from; n <= to; n = n + 1) {
  13.  
  14.             System.out.println(n + "");
  15.  
  16.  
  17.             if (n % 2 == 0) {
  18.                 System.out.println("^");
  19.  
  20.  
  21.             } else {
  22.                 System.out.println("");
  23.  
  24.             }
  25.         }
  26.  
  27.     }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement