How to list even numbers between 1 and 100?

Ads
 

How to list even numbers between 1 and 100?

Hi,

I Java to check if a number is even?

How to list even numbers between 1 and 100?

Thanks

View Answers

April 16, 2017 at 5:08 PM

Hi,

If number is divisible by 2 then its even number.

Suppose you have a variable i then you can use following code for finding if the number is even:

if(i%2==0 ){
//Number is even
}

You can use the for loop and print all the numbers between 1 and 100

for (int i=1;i <=num ; i++){
  if(i%2==0 ){
  System.out.print(i+",");
  }

Check complete example at Write a program to list all even numbers between two numbers.

Thanks

Ads









Related Tutorials/Questions & Answers:
How to list even numbers between 1 and 100?
Listing all even numbers between two numbers
Advertisements
Java Find Automorphic numbers
print the even numbers between the range 100-200
Prime numbers in Java between 1 and 100
write an application that print out the even numbers between the range 100-200
How to generate a list of random numbers?
How to generate a list of random numbers?
How to generate a list of random numbers?
print the sum of even number from 1 to 100
Program to display palindrome numbers between some range
Generate random number between two numbers in Scala
Generate random number between two numbers in Scala
Generate random numbers from 1 to 100
mysql difference between two numbers
how to add to numbers in java
How to get of lastmodified file list between two times in java?
Generate random numbers in Java
How to put text file numbers to array and check the position of numbers?
How to use between in mysql.
How to Addding 1 Year with PHP
how I make the numbers in descending order ?
list of all months between two dates in java
list of all months between two dates in java
How to add two numbers in Java?
how to write a program in java to print numbers in equalateral triangle
How to Create Multiplication Table from 1 to 10?
how to divide 1 web page into some parts...
how to divide 1 web page into some parts...
how to get string between two characters
How to print a equilateral triangle patren with numbers

Ads