Count even and odd number in java:
In java program, if we want to count even and odd number from a start position to a stop position, we can utilize using for loop.For count even number in java:
Here i am using for loop in java to count even and odd number. Two parameter start and stop will be passed into the method from main. Even number is counted if the remainder between that number and 2 is equals 0.For count odd number in java with for loop:
We simply change the comparable operator from "==" which is equal to "!=" which is different.To find out more about java hello world to print out a simple example:
Comments
Post a Comment