nested loop corvert to nested while

0 qoley vision · September 11, 2015
hello. can anyone please convert a code to me? this is that code, please convert to while loop with same output.



#include<iostream>
using namespace std;
int main()
{
                int i,j;
                for(i=1;i<=4;i++)
{
                                for(j=1;j<=4;j++)
                                cout<<"*";
                                cout<<"\n";
}                             
}


please anyone to convert it

Post a Reply

Replies

Oldest  Newest  Rating
0 qoley vision · September 12, 2015
thanks. u save me
+1 Milan Obrenovic · September 11, 2015
#include <iostream>
using namespace std;

int main()
{
   int i = 0, j = 0;

   while (i <= 4)
  {
      j = 0;

      while (j <= 4)
      {
          cout << "*" << endl;
          j++;
      }

      i++;
  }
 
  return 0;
}
  • 1

C++

107,178 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator