I managed to make the right one with help of a teacher(but he had changed the 1st main for loop and changed the codes quite a lot). I am more into solving this only using the inside 2 for loops and not affecting 1st one(Unless it is purely wrong). Maybe one of you guys can help me. Code is as below.:-
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("Enter the number of rows.\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf(" ");
}
for(k=n;k>0;k--)
{
printf("*");
}
printf("\n");
}
getch();
}