nested loop stuff

This is a discussion on nested loop stuff within the C++ Programming forums, part of the General Programming Boards category; how do i do this program? Write a program that uses nested loops to produce the following output. A1B1B2B3A2B1B2B3 some ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    126

    nested loop stuff

    how do i do this program?

    Write a program that uses nested loops to produce the following output.


    A1B1B2B3A2B1B2B3

    some help with code would be good.

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    194
    If looks like you are being asked to print out A1, then B1, B2 and B3
    then start the A loop again with A2, and go through the B loop again and print out B1, B2 and B3 again.

    Hint:
    print out a letter then the current count.
    2 loops will be nested

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    46
    Way to ask for someone to do your homework for you, but seeing as how I'm bored, I'll do it anyways.

    #include <stdio.h>

    int main(void)
    {
    int a, b;
    for (a=1;a<3;a++)
    {
    printf("A%d",a);
    for (b=1;b<4;b++)
    prtintf("B%d",b);
    }
    }

    -Max
    maxthecat.geo@yahoo.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. deriving classes
    By l2u in forum C++ Programming
    Replies: 12
    Last Post: 01-15-2007, 05:01 PM
  2. nested loop, simple but i'm missing it
    By big_brother in forum C Programming
    Replies: 19
    Last Post: 10-23-2006, 11:21 PM
  3. Nested for loop...search & display a list within a list
    By chadsxe in forum C++ Programming
    Replies: 13
    Last Post: 07-20-2005, 02:34 PM
  4. output from nested while loop
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 08-22-2002, 10:30 AM
  5. How to change recursive loop to non recursive loop
    By ooosawaddee3 in forum C Programming
    Replies: 1
    Last Post: 06-24-2002, 09:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21