Consider the algorithm you need to apply to achieve this. Express the steps in natural language first, to get it straight in your mind. When you think you have that sorted, try coding the steps. If you can't get your code to work, post it here.
You know you need a main() function. You know you need a loop of some kind. You know that inside the loop you need some form of output statement.
If you look at the desired output, some lines have different characteristics from others, so you need to cater for this in your output statement(s).
Try to make a general formula for printing 'spaces' and '&'.
For example :
The number of spaces that are to be printed in 1st line (outside the triangle) is one less than the number of lines given by user. It decreases by 1 as we move from one line to another.
Divide your task, which means, keep one loop that increments line, one that prints spaces outside the triangle, one that prints inside the triangle, and one that prints &
Also here is a hint : Try to print last line separately, that is outside loops that prints the upper part ( in your example, lines (1 - 4) means upper part, so lines (1 - 4) and 5 to be done separately ).
The rest of the world may not use the same compiler and OS as you do. Both conio.h and windows.h are dependent on the implementation. Further, this problem can be solved without resorting to non-portable libraries. You don't have to call gotoxy() when it's a simple matter of printing a few space characters.
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...