Even or Odd Program without using modules%

Let us see a java program finding even or odd without using modules operator. Frequent Interview question in technical or programming round. Programming languages  C#(sharp), python,php, c, c++,java.Even number is a number, which is divisible by two, rest of the numbers are odd numbers.

Class evenodd
	public static void main(String[] args)
	   int number=51;
	   int c;
	       System.out.println("Even number");
	      System.out.println("Odd number");

         Example1: number=51

         Let's check 51 is even or not
           c= 51-(51/2)*2;
         51 divide by 2 (51/2) will give 25 as quotient
           c = 51-(25)*2
           c = 51-50
           c = 1
         c=1, therefore we found that the given number 51 is an odd number
         Example 2:  number=40
          c= 40-(40/2)*2;
         40 divide by 2 (40/2) will give 20 as quotient
           c = 40-(20)*2
           c = 40-40
           c = 0
         c=0, therefore we found that the given number 40 is an even number.

Even or odd programs are also widely asked in interview for fresher, slightly in different format by different top mnc companies. Basic java program asked in interview:

         Check whether the given number is even or odd. Get input integer from user.

         Program to print 1st 50 even and odd numbers. using while loop