I am very naive at programming...n very new to it too..pls helpwith the following problem:
#include <iostream>
using namespace std;
int main()
{
int side;
cout << "Enter a number: ";
cin >> side;
for (int i = 0; i < side; i++)
{
int j = 0;
while (j <= i)
{
j++;
cout << '#';
}
cout << "\n";
}
}
i need to convert this to a do while loop n i did this:
#include <iostream>
using namespace std;
int main()
{
int side;
cout << "Enter a number: ";
cin >> side;
int i = 0;
int j = 0;
do
{
i++;
while (j <= i)
{
j++;
cout << '#';
}
cout << "\n";
}
while (i<side);
cout << '#';
}
but it is not working...i dont kno what is wrong!