Home Discussion Discuss: Check Even-Odd:-Example

• ### this is so nicesimon September 28, 2011 at 4:17 PM

i like this website its really helping us as jonour programers who'll one day become senior progamers! i thank you!!!

• ### Check Even-Odd numbers without modulo operator pradip December 23, 2011 at 4:25 PM

class OddEven{ public static void main(String args[]) { int a,flag=0; a = Integer.parseInt(args[0].substring(args[0].length()-1,args[0].length())); for(int i=0;i<9; i=i+2) { if(a==i) { flag=1; } } if(flag==1) System.out.println("even"); else System.out.println("odd"); } }

• ### DATA STRUCTURE AND ALGORITHMnessie February 14, 2012 at 6:01 AM

what is the validation to this program.

• ### himeralyn July 1, 2012 at 11:22 AM

thanks for the codes ive learned much from it..... meralyn

• ### need help...jester August 5, 2012 at 11:52 AM

Specify number of input: 5 Enter 5 numbers 1 5 2 8 14 Numbers of odd numbers : 2 Numbers of even numbers : 3 can you make a program for this

• ### javaishwar chhetri September 27, 2012 at 2:38 PM

what is the purpose of try and catch command in this prgr thanx for example

• ### Even / odd numbers - fastest algorithmRob October 13, 2012 at 6:28 PM

Most even/odd number checkers do it like this: if (number%2==0 then system.out.println('EVEN'); Although this is absolutely correct, we need to remember that computer can only add number, so the larger the given number is, the longer it is for the computer to come up with the answer assuming that %2 actually divides the number multiple times by 2). So, my question is how to make even/odd determination as fast as possible?

• ### hi...........preetha January 2, 2013 at 4:42 PM

this soource code program was i think wrongly simplyfied............