Guest User

Untitled

a guest
May 20th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. package loopex3;
  2. import java.util.Scanner;
  3.  
  4.  
  5. public class LoopEx3 {
  6.  
  7.     public static void main(String[] args) {
  8.      Scanner sc = new Scanner(System.in);
  9.      System.out.println("Input an integer number");
  10.     int i = sc.nextInt();
  11.     if (i<2)
  12.     {
  13.         System.err.println("Please input 2 or larger");
  14.     }
  15.     else{
  16.     for (int a=2; a<=i; a = a+2)
  17.     {
  18.         System.out.println(a);
  19.     }
  20.     }
  21. }
  22. }
Add Comment
Please, Sign In to add comment