#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n = 4;
int i;
// outer loop
for(i = 1; i <= n; i++){ // mistake int i was present, so 5 was not printing
due to this reason
int val = i;
// inner loop
for(int j = 1; j <= n; j++){
//work
cout << val << " ";
}
cout << endl;
}
cout << i << endl;
return 0;
}
OUTPUT:-
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5
No comments:
Post a Comment