473,326 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Help Needed - Nested loops

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
6 2006
Banfa
9,065 Expert Mod 8TB
Well can you create a loop that prints

A1A2A3A4A5

?
Nov 1 '06 #2
r035198x
13,262 8TB
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
evantri
25
Do u know what loop to be used? There are 3 common loops in C eventually..
Nov 4 '06 #4
DarmaI
3
I have to use a for loop.
Nov 7 '06 #5
DarmaI
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
4,677 Expert Mod 4TB
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

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

Similar topics

25
by: chad | last post by:
I am writing a program to do some reliability calculations that require several nested for-loops. However, I believe that as the models become more complex, the number of required for-loops will...
0
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # David Eppstein of the Geometry Junkyard fame gave this elegant # version for returing all possible pairs from a range of n numbers. def combo2(n): return...
46
by: Neptune | last post by:
Hello. I am working my way through Zhang's "Teach yourself C in 24 hrs (2e)" (Sam's series), and for nested loops, he writes (p116) "It's often necessary to create a loop even when you are...
0
by: Paolo Tavalazzi | last post by:
I have a problem on FROM subselect that i don't understand. I do two query different only for a WHERE clause in a FROM subquery . 1) explain analyze SELECT DISTINCT ON...
9
by: Gregory Petrosyan | last post by:
I often make helper functions nested, like this: def f(): def helper(): ... ... is it a good practice or not? What about performance of such constructs?
3
by: tzuriel | last post by:
Hello all, I think nested loops will do what I want, but I can't seem to get them right. I have two tables, members and casts. I run a query as follows: $sql_query="SELECT DISTINCT...
5
Reika
by: Reika | last post by:
Hello, I need help understanding some things in programming. I'm taking a high school level programming course, however my teacher is less than helpful in explaining or even understanding the...
5
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
Could someone give me a simple example of nested scope in C#, please? I've searched Google for this but have not come up with anything that makes it clear. I am looking at the ECMA guide and...
1
by: pstuning | last post by:
if you see the cost of QUERY time in below joining of table and 2 views we can easily say it is taking a lot of time. This is a production support issue and i need some help. SELECT...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.