here is the code for displaying numbers repeatedly using nested loop.
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
for(int x= 1;x<=5;x++) {
for(int y=1;y<=5;y++) {
cout<<y;
}
cout<<"\n";
}
cin.get();
cin.get();
return 0;
}
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
int a = 1;
cout<<"Enter N:";
cin>>a;
for(int x= 1;x<=a;x++) {
for(int y=1;y<=a;y++) {
cout<<y;
}
cout<<"\n";
}
cin.get();
cin.get();
return 0;
}


No comments:
Post a Comment