+ 1
I want to get the following output using nestted loops ...c++ ...please can anyonehelp?
1 3 5 5 7 9 7 9 11 13
2 Respostas
+ 8
The following are codes that I have written to suit your needs, however, I am not really sure how to explain them to you... You may try to examine the codes first and if you come up with any questions, I will try to answer you.
#include <iostream>
using namespace std;
int main()
{
int i = 0;
int j = 1;
int k = 2;
int l = 1;
for (i = 0; i < 4; i++)
{
for (j = l; j < k; j += 2)
{
cout << j << " ";
}
cout << endl;
l = l + 2;
k = k + 4;
}
return 0;
}
+ 2
a huge thanks to you I understood it very clearly....thanks