Ask your own question, for FREE!
Computer Science 11 Online
OpenStudy (anonymous):

generate a single digit number that represents number of lines two display and write a program in java to generate following pattern 1 121 12321 1234321 123454321

OpenStudy (anonymous):

Google "java for loop pyramid"

OpenStudy (anonymous):

public static void main(String[] args) { int x = 5; // this is the number of lines for (int i = 1; i <= x; i++) { for (int j = 1; j <= x - i; j++) { System.out.print(" "); } for (int k = 1; k <= i; k++) { System.out.print(k); } if (i >= 2) { for (int l = 1; l <= i - 1; l++) { System.out.print(i - l); } } System.out.print("\n"); } }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!