Print the upper half triangle of a matrix
When looking at your code I just want to say: Please reconsider your indentation!. This code should be rather easy to read, but you've complicated it quite a bit by not using braces around the blocks of the if statements, and leaving them at the same indentation, and why the excessive amount of indentation with the for loops?

So here are some style suggestions:


Keep indentation consistent at 4 spaces – Don't change indentation between different blocks, but keep it the same all the time
Always indent after if, for, while – Don't skip it like you've done in your inner loop
Add space after , and ;, and between operators – Having the blocks like for(i=0;i&lt;r;++i) makes your code hard to read. Use spaces like in for (i=0; i&lt;r; ++i) or if (j == (c-1)))
Use descriptive variable names – Whilst i and j is common as loop variables, please use more descriptive names like row, column, or matrix for the other variables to describe what they represent
Use braces around the blocks – Your code is prime example of the need to use braces around the blocks of if, for and while. By always adding braces around your code blocks, you are sure that the correct code is executed (and your 'faulty' indentation) won't give you any surprises!


And here are some code suggestions:


Use the if statement properly as suggested by ratchet freak – Either use it directly, or depending on which triangle you want to output a loop where you avoid the if completely. i.e. for (j=0; j&lt;i &amp;&amp; j &lt; c; ++j), possibly with an indentation before that if needed and not zero based. If you don't understand this, do go with the suggestion by ratchet freak
Bug/Feature: If you enter r or c larger than 10, it fails miserably – You should add error handling if the input is outside of your intended range, or you should make your code more dynamic allowing for larger ranges.