We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
You have 5 loops in your code.
- You can remove the loop of middle line simply by saying that there is 1 more line in upper triangle.
- You can merge upper and lower triangles with a clever usage of the absolute function (abs()).
- And by using a recursive function, you can simulate a loop without loop.
Real work is left to you since it is HomeWork.
-----------------------
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[
^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^]
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
When the code don't do what is expected, you are close to a bug.
Advice: tale a sheet of paper and try to do it by hand, your program should use the same procedure.