Java Program to Print Even Numbers from 1 to N - The Coding Shala
In this post, we will learn how to Display Even Numbers from 1 to n using Java Program.
Java Program to Print Even Numbers from 1 to N
Write a Java Program to display even numbers from 1 to given n. We can use Java loops here.
We can use a for loop from 1 to n and will check if the current number is divisible by 2, if it is divisible by 2 then it's an even number else not.
We can also start from 2 and increase the current number in the loop by 2 and print all the numbers till n.
- Java Program to Check Armstrong Number
- Java Program to Reverse a Number
- Java Program to Check if Number is Palindrome
- Java Program to Check Prime Number
- Java Program to Find the Area of a Triangle