Solve the java problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Solve the java problem

Write the java program for the following scenario print the following pattern with the input string. Accept the string from the user. Input string ‘JAVA’ Triangle pattern: J AAA VVVVV AAAAAAA

2nd May 2023, 12:23 PM
Bishal sapkota
Bishal sapkota - avatar
2 Answers
+ 9
What is your attempt?
2nd May 2023, 12:34 PM
Justice
Justice - avatar
+ 5
Follow these steps 1 - use for loop 2 - inside for loop do int m = 2 * i + 1; //here i will start from 0 3 - now use another for loop inside first loop and print each character till m times. 4 - to read each character use charAt(i) method.
2nd May 2023, 12:46 PM
A͢J
A͢J - avatar