Originally posted by raghuram vardharajan:
CAN ANY BODY HELP ME OUT IN THIS PROBLEM.I WANT TO PRINT THE BELOW FORMAT
ON THE SCRREN.PLEASE HELP ME WITH THE LOGIC TO SOLVE IT
4 5 6
7 8 9 10
[ August 05, 2007: Message edited by: raghu rajan ]
You need an int variable to store the number of rows you want to print. A main loop will check against exceeding this value.
Another int variable is needed to store the current value being printed (this will be incremented after each print).
And finally, an int variable is needed to store the current row being printed (incremented after each row is printed).
In printing a row you use a for loop - from 1 to current row #. The for loop will use System.out.print() and System.out.println().