Help please. C++ Nested Loop Modify??

0 Molly Auchter · February 19, 2015
I need to modify my program to have the following output. Can someone tell me what i need to do? I don't understand/images/forum/upload/2015-02-19/8832007209ce3009dc4b8c73d035be89.png

Post a Reply

Replies

Oldest  Newest  Rating
+1 Cardinal Coog · February 21, 2015
You really should do your own homework; that's the only way you'll learn. But, I'm feeling generous today and today ONLY.
Try this:

#include <iostream>

using namespace std;

int main()
{

    int i, j;


    for(i = 1; i <= 3; i++){
        for(j = 2; j <= 4; j++){
                cout << "i = " << i << " j = " << j << endl;
                }
    }

    return 0;

}
+1 Shahriar Morabi · February 21, 2015
#include <iostream>
using namespace std;
int main()
{
    for(int i=1;i<=3;i++)
        for(int j=i+1;j<=4;j++)
          cout<<"i = "<<i<<"\t j = "<<j<<endl;
return 0;
}
+1 Seems Legit · February 19, 2015
What is it that you don't understand? Beceause when I give you the answer you won't learn anything :)
+1 Abdullah Nauman · February 19, 2015
Are you getting any errors? If so can I have them? 

Also, I don't think we are allowed to help you with your homework. Anyways, this might answer your question.  

0 Molly Auchter · April 25, 2015
Wow... I didn't see the replies, but I wasn't asking for anyone to do my work. 

Thank you for all that assisted and was nice about it. I did figure out what I was doing wrong.This wasn't anything that I had to turn it in. It was just for me and I realized I was changing the wrong thing. 
  • 1

C++

107,272 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator