Categories
Java

Even Number Generators in Java

 A simple program to ask the user to give a number and the program will generate even numbers using Java programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Program Listing

EvenNumbers.java


/* EvenNumbers.java
 * Author : Jake Rodriguez Pomperada, MAED-IT, MIT
 * March 6, 2021  9:20 PM Saturday
 * www.jakerpomperada.blogspot.com
 * www.jakerpomperada.com
 * jakerpomperada@gmail.com
 * Bacolod City, Negros Occidental
 * 
 * Machine Problem in Java
 * 
 * Write a program to ask the user to give a number and then
 * it will generate the even numbers based on the given number by
 * the user.
 * 
 */
import java.util.Scanner;

class EvenNumbers {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
		System.out.print("\n\n");
		System.out.print("\tEven Number Generators in Java");
		System.out.print("\n\n");
        System.out.print("\tEnter a number: ");
        int number = scan.nextInt();
        int res;
        System.out.print("\n");
        for (int i=1; i<number; i++) {
        	  System.out.print("\t");
            res = number - i;
            if (i%2==0) {
                System.out.println(res);  
            }  
        }
 
	System.out.print("\n\n");
	System.out.print("\tEnd of Program");
	System.out.print("\n\n");
    scan.close();
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *