programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Liutauras Vilda
• Campbell Ritchie
• Tim Cooke
• Bear Bibeault
• Devaka Cooray
Sheriffs:
• Jeanne Boyarsky
• Knute Snortum
• Junilu Lacar
Saloon Keepers:
• Tim Moores
• Ganesh Patekar
• Stephan van Hulst
• Pete Letkeman
• Carey Brown
Bartenders:
• Tim Holloway
• Ron McLeod
• Vijitha Kumara

# Output question

Greenhorn
Posts: 16
Howdy,

I have the following code... which outputs fine like this:

1
2
3
and so on...

I need it like this
3 2 1
6 5 4
down to 200

so 200 to 1.. backwards!

Any ideas? Thanks a lot

Saloon Keeper
Posts: 4765
52

Mario Jorge wrote:I need it like this
3 2 1
6 5 4
down to 200
so 200 to 1.. backwards!

It is not sufficient to just provide an example because we don't know what the rules are. You'll need to provide a description of the problem as well, such as...
• Display the numbers from 1 to 200(not inclusive)
• Display three numbers per line in descending order
•
Mario Jorge
Greenhorn
Posts: 16
Hey - i need to have counter that prints out, in reverse order, every multiple of 3 between 1 and 200..
Make sense?

Carey Brown
Saloon Keeper
Posts: 4765
52

Mario Jorge wrote:Hey - i need to have counter that prints out, in reverse order, every multiple of 3 between 1 and 200..
Make sense?

You can create a for loop that increments by 3 by using i+=3.

Mario Jorge
Greenhorn
Posts: 16
changed the loop section and now getting out put of

15
0
0
12
0
0
9
0
0
6
0
0
3
0
0
0

its right to a point... the zeros need going... i know its something simples...

Carey Brown
Saloon Keeper
Posts: 4765
52
First off you don't need numIndex at all, you can just print the loop value directly.
Secondly, you'll need two *nested* loops, one to count down by 3 (i-=3) and the other to count down from 3.
Then a println that combines the two loop counter values.

 Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters?