Help Needed - Nested loops

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DarmaI
    New Member
    • Oct 2006
    • 3

    #1

    Help Needed - Nested loops

    Code:
    Write a program that uses nested loops to produce the following output:
    
    A1B1B2B3A2B1B2B3
    I have no idea how to proceed with this, if anyone could help me that would be awesome. :)
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Well can you create a loop that prints

    A1A2A3A4A5

    ?

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Can you create any loops at all? It's more interesting when you write a loop and then post it for correction or comments.

      Comment

      • evantri
        New Member
        • Sep 2006
        • 25

        #4
        Do u know what loop to be used? There are 3 common loops in C eventually..

        Comment

        • DarmaI
          New Member
          • Oct 2006
          • 3

          #5
          I have to use a for loop.

          Comment

          • DarmaI
            New Member
            • Oct 2006
            • 3

            #6
            I tried this but it didnt work

            Code:
            for (int a = 1; a <=2 ; a++) 
            for (int b = 1; b<=3; b++)

            Comment

            • sicarie
              Recognized Expert Specialist
              • Nov 2006
              • 4677

              #7
              Code:
              for (int a = 1; a <=2 ; a++) 
              for (int b = 1; b<=3; b++)
              That's a good start for the loops, but there are no output statements in there. Depending on if you are using C or C++, you can use 'cout' or 'printf()'.

              Here is a link for C++:


              and here's a link for C:
              Our goal is to apply the principles of quantum mechanics and electronic structure theory to address problems in physical, organic, inorganic, and biological chemistry. High performance computers are used to solve the complex equations describing the system of interest, yielding predictions of structures, bonding, energetics, reactivity, and other physical properties


              Then see what output you get.

              Comment

              Working...