Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package loopex3;
- import java.util.Scanner;
- public class LoopEx3 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Input an integer number");
- int i = sc.nextInt();
- if (i<2)
- {
- System.err.println("Please input 2 or larger");
- }
- else{
- for (int a=2; a<=i; a = a+2)
- {
- System.out.println(a);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment