+ 1
any other way to print pair of numbers whose sum is always less than the third number(n here)??
6 ответов
+ 2
Your code is wrong: try the inputs 1 3 2.
You must replace
if (i+j!=n)
with
if i+j<n
Regarding the code alternatives, there is not much to do.
You can try a sort of oneliner like this;
https://code.sololearn.com/c2ejROIBwSGm/?ref=app
+ 1
?? you can't have a sum of two number that's "always" less than a third number unless you force the user to input something within a range in a while loop. (or am i missing something?)
+ 1
just check the output of the program by taking inputs
1
1
2
+ 1
aah, i see what you doing now, sorry.. misunderstood.
0
the sum of 1 and 1 is not less than 2.
0
since the output is in the form
0 0
0 1
1 0
thus these 3 cases have sum less than 2 only (i.e.0 in first and 1 in rest two)