Rakeshgombi / Hactoberfest-2021

Repository for Hactoberfest
https://hacktoberfest.digitalocean.com/
22 stars 90 forks source link

Create DisplayEvenNumber.java #115

Closed biranchinarayan closed 2 years ago

biranchinarayan commented 2 years ago

In the following code. I declared a variable named number and initialized it with 100 (the limit to print the even number). I used a for loop that executes up to 100 times and for each iteration of the if statement checks the number is even or not. After printing each even number, the value of i is increased by 1.

To check the number, I divided the number by 2 if it does not leave any remainder, the number is even and the print statement prints that number.