Advertisement
apez1

Term 1: Lesson 17 - Coding Activity 2

Sep 25th, 2018
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1.  
  2.     public class Lesson_17_Activity_Two {
  3.  
  4.  public static void main(String[] args) {
  5.  
  6.    System.out.println("Enter two numbers:");
  7.       Scanner scanner = new Scanner(System.in);
  8.       int first = scanner.nextInt();
  9.       int second = scanner.nextInt();
  10.      
  11.       for (int i=first; i<=second; i++) {
  12.         if (i % 2 == 0) {
  13.           System.out.print(i+" ");
  14.         }
  15.       }
  16.    
  17.  }
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement