Number of ways to choose a pair containing an even and an odd number from 1 to N | Java implementation of the above approach ; Driver code
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { public static void main ( String args [ ] ) { int N = 6 ; int Even = N / 2 ; int Odd = N - Even ; System . out . println ( Even * Odd ) ; } }