Can u explain the logic which i have to use in it as even after multiple tries i m not able to solve it?

Take as input N, a number. Print the pattern as given in output section for corresponding input.

Input Format
Enter value of N

Constraints
Output Format
All numbers and stars are Space separated

Sample Input
5
Sample Output
1 2 3 4 5
1 2 3 4 *
1 2 3 * * *
1 2 * * * * *
1 * * * * * * *
Explanation
Catch the pattern for the corresponding input and print them accordingly.

Hello @coding123c,
If you look at the pattern in the first row all the integers from 1 to n are printed. Then in further rows 1 to n-1. So to print that pattern you start from 0 as in first row all the numbers are printed then subsequently 1,2,3… till n-1.
Now for * pattern if you observe the * are print in odd numbers starting from 0 to 1,3,5,7…
Using this logic try creating your code.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.