- 1
Write C++ program to print the numbers from 1 to 36 each 4 on one line (nested for loop)
I tried to solve but I didn't
3 Réponses
+ 4
Hi! Please, show us your code attempt! Thx!
0
The answer
int i,j,m=0;
for(i=1;i<=9;i++)
{
for(j=1;j<=4;j++)
{
m++;
cout<<m<<" ";
}
cout<<endl;
}
0
#include <iostream>
using namespace std;
int main() {
int n=1;
for (int i=1;i<=9;i++)
{
for (int j=1;j<=4;j++)
{
cout<<n;
n++;
}
cout<<endl;
}
return 0;
}