We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
If you get stuck on a particular bit, then ask about that - but this is your task, and we will not do it for you!
I did It....By Using Five If Conditions......
:laugh:
Look at each if condition. If "i" is "n" then you start "k" from "n"...so why check the "i" value, instead just start the "k" loop from "i"?
Time to put you out of your misery, you are close enough!
Here is my version:
for (int i = 1; i <= 5; i++)
{
for (int k = i; k > 1; k--)
{
Console.Write(k + " ");
}
for (int j = 1; j <= i; j++)
{
Console.Write(j + " ");
}
Console.WriteLine();
}
Do you see what I mean now? Does that make sense?