Please give me the code as well as the algorithm for the following 3 questions,

1) To generate the following pattern using 'for' loop.
1 2 3 4
1 2 3
1 2
1
1 2
1 2 3
1 2 3 4

2)Write a program to take N array inputs and sort them in ascending order.

3)Write a program to perform the following matrix operations,
a).Check the given matrix for symmetric.
b).Find the sum of diagonal(major or minor axis).

Please give me the code as well as the algorithm for the following 3 questions,

1) To generate the following pattern using 'for' loop.
1 2 3 4
1 2 3
1 2
1
1 2
1 2 3
1 2 3 4

Give you the code? No. Or maybe something like this:

``````#include <iostream>
#define for_loop std::cout << "1234\n123\n12\n1\n12\n123\n1234";
int main( )
{
for_loop
return 0;
}``````

But seriously: you'll have to put in some effort before you get some code. The first assignment is very easy and shouldn't give you to much problems. If you don't get the first assignment, the other two will be near impossible to complete.

So the question is: With which part do you have problems? Do you understand how for-loops work? If not: don't start with #2 and #3.