In java a number can be identified as odd or even by using modulo operator i.e. “%”. The modulo operator gives the remainder of a division operation, for instance the result of 5 % 3 would be 2. Also, any even number when divided by 2, leaves a remainder of zero. Thus, the algorithm would be if the remainder is 0, it is an even number else it is an odd number. Below is the code snippet of this algorithm in java:

public class OddEvenChecker

{

public static void main(String [] args)

{

if(args.length == 0)

{

System.out.println("Provide the number");

System.exit(0);

}

int n = Integer.parseInt(args[0]);

if(n % 2 == 0)

{

System.out.prinlnt("Number is even");

}

else

{

System.out.println("Number is odd");

}

}

}

Thus using the remainder or modulo operator, it can be checked if a number is odd or even.

Please let us know for any queries or feedback in the comments section below.

In open distributed systems the static assumptions of existing systems does not work and evolution is more difficult because it is not possible to control how or when the packages change and correct operation depends on a greater number of dependencies between packages. What is needed is an updated set of conventions and mechanisms that specify how the packages of a system should evolve so that the goal of an open reliable scalable distributed system can be achieved.