🔒 Closed Help! Nested loop

Status
Not open for further replies.
C++:
#include <iostream>

using namespace std;

int main() {
 int a, b, c;
    for(a=1;a<=20;a++){
        cout<<a<<" ";
        b=a%5;
        c=a;
        while(c<10){
            cout<<" ";
            c=10;
        }
        while(b==0){
            cout<<endl;
            b=1;
        }
    }
    return 0;
}
 

Attachments

  • 1638450765108.webp
    1638450765108.webp
    26.7 KB · Views: 24
Hello sir
C++:
#include <iostream>

using namespace std;

int main() {
 int a, b, c;
    for(a=1;a<=20;a++){
        cout<<a<<" ";
        b=a%5;
        c=a;
        while(c<10){
            cout<<" ";
            c=10;
        }
        while(b==0){
            cout<<endl;
            b=1;
        }
    }
    return 0;
}
Hello sir! Salamat po, gumana!
 
C++:
#include <iostream>
using namespace std;

int main(){
    int counter=0;
    for(int i=1;i<=4;i++){
        for(int j=1;j<=5;j++){
            counter++;
            cout<<counter<<"\t";
        }
        cout<<endl;
    }
    return 0;
}
 
Status
Not open for further replies.

About this Thread

  • 7
    Replies
  • 665
    Views
  • 4
    Participants
Last reply from:
FoXOnE23

Trending Topics

Online now

Members online
1,224
Guests online
3,375
Total visitors
4,599

Forum statistics

Threads
2,308,310
Posts
29,184,412
Members
1,191,934
Latest member
Colmi
Back
Top