I have a simple quastion.
I have this C# code:
static void Main(string[] args)
{
int num1, i, j, x, y;
Console.WriteLine("enter number");
num1=int.Parse(Console.ReadLine());
for (i=1; i<=num1; i++){
for (j=1; j<i+1; j++) {
Console.Write(i);
}Console.Write("\n");
}
for (x=num1; x>=0; x--){
for (y=0; y<x; y++) {
Console.Write(x);
}Console.Write("\n");
}
Console.ReadLine();
}

The middle line is repeat twice
Which print triangle from numbers.
The problem is that the middle line is repeated twice.
My question is how can I change the loop, so the middle line numbers will repeat twice?
Wish for help, thanks!
Because both for loops include
num1as an inclusive condition:Change the first loop to stop BEFORE
num1: