hi i need help on getting this kind of output, badly needed to finish this cuz I've been scrambling my brain to think of a looping that to generate this kind of output...thanks in advance
The most important thing to notice is the patterns of 3 different things:
1. The spaces on the left
2. The highest number on the left
3. The lowest number on the right
Each of these 3 things can be represented by some type of loop that increments or decrements a counter variable (such as a for loop)
If I take a step back and think about a loop to control all 3 instead of individual loops, I notice that 9-<first column> = <second column> and 1+<first column> = <third column>
So if there was a loop that kept track of the <first column>, I would also know the starting numbers for the <second column> and <third column> loops by applying those formulas
1 2 3 4 5
for(int i=8; i>=0; i--) {
//increasing for loop to print i spaces
//increasing for loop to print digits from 1 to 9-<first column> aka 9-i
//decreasing for loop to print digits from 9 to 1+<first column> aka 1+i
}
You could also base the control loop off of either of the other 2 columns, but I will leave that as an exercise for the reader.
super thanks "kevinkjt2000" you've helped me a lot. now I'm laughing on my stupidity now hahaha...lol all that i need is the logic for the spacing now my looping is now working. And now my mind will be at ease hahahahah...on to my next exercise....