The value of c = n - a - b
int c = n - a - b ; if ( a * a + b * b == c * c && b > 0 && c > 0 ) { cout << a << " ▁ " << b << " ▁ " << c ; flag = 1 ; break ; } } if ( flag == 0 ) { cout << " - 1" ; } return ; }