3 Replies - 137 Views - Last Post: 08 September 2012 - 05:52 AM Rate Topic: -----

#1 devil19xp  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 9
  • Joined: 08-September 12

question how to do this?

Posted 08 September 2012 - 04:04 AM

#include <iostream>

using namespace std;

int main()
{
//how to make all the output 
 //in increasing order a,b,c,d where "a" will be smaller than "b"
                        //and "b"  smaller  than "c";                                 
    for(int a=1;a<30;a++ ){ //for example in this format (a< b),(b<c),(c<d),(d)
    for(int b=2;b<40;b++ ){ //    example the output 2,4,7,18 
      for(int c=4;c<50;c++ ){    // where "2" is smaller than "4"
            for(int d=10;d<66;d++ ){ //"4" is smaller than "7"
cout<<a<<","<<b<<","<<c<<","<<d<<endl;//"7" is smaller than "18"
                                   }
                            }
                          }
                          }
    return 0;
}

This post has been edited by Salem_c: 08 September 2012 - 04:08 AM
Reason for edit:: added [code][/code] tags - learn to use them yourself


Is This A Good Question/Topic? 0
  • +

Replies To: question how to do this?

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1418
  • View blog
  • Posts: 2,681
  • Joined: 30-May 10

Re: question how to do this?

Posted 08 September 2012 - 04:11 AM

Like this?
for(int a=1;a<30;a++)
  for(int b=a+1;b<30;b++)


Was This Post Helpful? 0
  • +
  • -

#3 devil19xp  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 9
  • Joined: 08-September 12

Re: question how to do this?

Posted 08 September 2012 - 04:37 AM

it didnt work...

View PostSalem_c, on 08 September 2012 - 04:11 AM, said:

Like this?
for(int a=1;a<30;a++)
  for(int b=a+1;b<30;b++)


it didnt work...
Was This Post Helpful? -2
  • +
  • -

#4 no2pencil  Icon User is offline

  • Original Digital Gansta
  • member icon

Reputation: 4463
  • View blog
  • Posts: 24,908
  • Joined: 10-May 07

Re: question how to do this?

Posted 08 September 2012 - 05:52 AM

That's not good enough
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1