All possible co | Java implementation of the approach ; Function to count possible pairs ; total count of numbers in range ; printing count of pairs ; Driver code
import java . util . * ; class solution { static void CountPair ( int L , int R ) { int x = ( R - L + 1 ) ; System . out . println ( x / 2 + "NEW_LINE"); } public static void main ( String args [ ] ) { int L , R ; L = 1 ; R = 8 ; CountPair ( L , R ) ; } }