MrDoyle

For) Counting Machine

Nov 13th, 2020
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         System.out.println();
  7.         System.out.print("Please input a number, and i will show you my counting skills:");
  8.         Scanner keyboard = new Scanner(System.in);
  9.         int num = keyboard.nextInt();
  10.         int n;
  11.         System.out.println();
  12.  
  13.         for (n=0 ; n <= num ; n++){
  14.             System.out.print(n + " ");
  15.         }
  16.         System.out.println();
  17.     }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment