how to write a program using nested while loops

please help me doing my assignmnet, I have to write a program using nested while loops which will show the ouput as follows
1
2 2
3 3 3
4 4 4 4
and using the same nested while loops a program that shows following output
1
2 3
4 5 6
7 8 9 10
1
2
3
4
int main ()
{
// insert code here
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using std::cout;
using std::endl;


int main(){


int
        counter1=1,
        counter2=1;

while(counter1<=4){
        while(counter2<=counter1){
                cout<<counter1;
        counter2++;
        }//end inner while
        cout<<endl;
        counter2=1;
counter1++;
}//end outer loop while

return 0; //indicates successful termination
}//end main 


1
22
333
4444


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
using std::cout;
using std::endl;


int main(){


int
        counter1=1,
        counter2=1,
        counter3=0;

while(counter1<=4){
        while(counter2<=counter1){
                cout<<++counter3;
        counter2++;
        }//end inner while
        cout<<endl;
        counter2=1;
counter1++;
}//end outer loop while

return 0; //indicates successful termination
}//end main 


1
23
456
78910
Topic archived. No new replies allowed.