Number of ways in which N can be represented as the sum of two positive integers | C ++ implementation of the approach ; Function to return the number of distinct ways to represent n as the sum of two integers ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int ways ( int n ) { return n / 2 ; } int main ( ) { int n = 2 ; cout << ways ( n ) ; return 0 ; }