## AndroidBerry.com |

An even number is an integer which is "evenly divisible" by two. This means that if the integer is divided by 2, it yields no remainder.

**Example**

To find 10 is a even number

10 / 2 = 5

Hence we can say that the 10 is a Even number.

An odd number is an integer which is not a multiple of two or we can say that The number is which is not even is a odd number.

**Example - **1,3,5,7.. etc

import java.util.Scanner; public class EvenOddEx { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int number; System.out.print("Enter any number : "); number = scan.nextInt(); if(number % 2 == 0) System.out.println(number+" is even number"); else System.out.println(number+" is odd number"); } }

Enter any number : 6

6 is even number

6 is even number

import java.util.Scanner; public class EvenOddEx { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int number; String result; System.out.print("Enter any number : "); number = scan.nextInt(); result = (number % 2 == 0 ? "Even number": "Odd number"); System.out.println(number+" is "+result); } }

Enter any number : 7

7 is Odd number

7 is Odd number

import java.util.Scanner; public class EvenOddEx { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int start,end; String result; System.out.print("Enter starting and ending number : "); start = scan.nextInt(); end = scan.nextInt(); for(int i=start;i<=end;i++) { if(i % 2 == 0) System.out.println("Even - "+i); else System.out.println("Odd - "+i); } } }

Enter starting and ending number : 5 10

Odd - 5

Even - 6

Odd - 7

Even - 8

Odd - 9

Even - 10

Odd - 5

Even - 6

Odd - 7

Even - 8

Odd - 9

Even - 10

public class EvenOddEx { public static void main(String[] args) { int addition=0; for(int i=1;i<=10;i++) { if(i % 2 == 0) addition += i; } System.out.println("Addition is : "+addition); } }

Addition is : 30