Number of ways in which N can be represented as the sum of two positive integers | Java implementation of the approach ; Function to return the number of distinct ways to represent n as the sum of two integers ; Driver code
class GFG { static int ways ( int n ) { return n / 2 ; } public static void main ( String args [ ] ) { int n = 2 ; System . out . println ( ways ( n ) ) ; } }