AMCAT Automata Fix Sample Question-2

Program 2

Print Sequence

Find the logical error in the below code.
expected output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

void main()
{
   int n=5;
   for (int i = n; i >= 1; --i)
   {
    	for (int j = 1; j <= i; ++j)
    	{
        	printf("%d ", j);
    	}
    	printf("\n");
   }
   return 0;
}
void main()
{
   int n=5;
   
   for (int i = 1; i <= n; ++i)
   {
    	for (int j = 1; j <= i; ++j)
    	{
        	printf("%d ", j);
    	}
    	printf("\n");
   }
   return 0;
}