Split a number into 3 parts such that none of the parts is divisible by 3 | CPP program to split a number into three parts such than none of them is divisible by 3. ; Print x = 1 , y = 1 and z = N - 2 ; Otherwise , print x = 1 , y = 2 and z = N - 3 ; Driver code
#include <iostream> NEW_LINE using namespace std ; void printThreeParts ( int N ) { if ( N % 3 == 0 ) cout << " ▁ x ▁ = ▁ 1 , ▁ y ▁ = ▁ 1 , ▁ z ▁ = ▁ " << N - 2 << endl ; else cout << " ▁ x ▁ = ▁ 1 , ▁ y ▁ = ▁ 2 , ▁ z ▁ = ▁ " << N - 3 << endl ; } int main ( ) { int N = 10 ; printThreeParts ( N ) ; return 0 ; }