Triplet with no element divisible by 3 and sum N | C ++ program to print a , b and c such that a + b + c = N ; Function to print a , b and c ; check if n - 2 is divisible by 3 or not ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void printCombination ( int n ) { cout << 1 << " ▁ " ; if ( ( n - 2 ) % 3 == 0 ) cout << 2 << " ▁ " << n - 3 ; else cout << 1 << " ▁ " << n - 2 ; } int main ( ) { int n = 233 ; printCombination ( n ) ; return 0 ; }