[Solved] want to create diamond shape using while in C


It would help to see your code for your implementation of the while loop to see what’s wrong, but the general solution for converting a for loop to a while loop is this:

for(i=1;i<=2;i++)
{ 
  /*your code*/ 
}

becomes

i = 1;
while(i<=2)
{
  /*your code*/
  i++;
}

Make sure your iterators and decrementors are in the right places.

1

solved want to create diamond shape using while in C