By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

Help Needed - Nested loops

P: 3
Expand|Select|Wrap|Line Numbers
  1. Write a program that uses nested loops to produce the following output:
  2.  
  3. A1B1B2B3A2B1B2B3
I have no idea how to proceed with this, if anyone could help me that would be awesome. :)
Oct 31 '06 #1
Share this Question
Share on Google+
6 Replies


Banfa
Expert Mod 5K+
P: 8,916
Well can you create a loop that prints

A1A2A3A4A5

?
Nov 1 '06 #2

10K+
P: 13,264
Can you create any loops at all? It's more interesting when you write a loop and then post it for correction or comments.
Nov 1 '06 #3

P: 25
Do u know what loop to be used? There are 3 common loops in C eventually..
Nov 4 '06 #4

P: 3
I have to use a for loop.
Nov 7 '06 #5

P: 3
I tried this but it didnt work

Expand|Select|Wrap|Line Numbers
  1. for (int a = 1; a <=2 ; a++) 
  2. for (int b = 1; b<=3; b++)
Nov 7 '06 #6

sicarie
Expert Mod 2.5K+
P: 4,677
Expand|Select|Wrap|Line Numbers
  1. for (int a = 1; a <=2 ; a++) 
  2. 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++:
http://www.cplusplus.com/doc/tutorial/files.html

and here's a link for C:
http://vergil.chemistry.gatech.edu/r...torial/io.html

Then see what output you get.
Nov 7 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.