You have to print “spaces” like the pattern 2 and print the “stars” like pattern 1. For printing “spaces” you have to use another loop before printing the “stars” and after the first loop. My code is not that good. if you have any efficient code , feel free to share.
Here is my code :
int m, n,z,u=5; // “u” is for taking inputs from users.
for (m = 1; m <= u; m++)
for (n = u-1; n >=m ; n–)
for (z = 1; z <= m; z++)