How do i reverse the alphabet and taking off the fisrt char? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i reverse the alphabet and taking off the fisrt char?

I want to print this, but without the replace or subtring function zywvtsrqponmlkjihgfedcba ywvtsrqponmlkjihgfedcba wvtsrqponmlkjihgfedcba . . . rqponmlkjihgfedcba qponmlkjihgfedcba ponmlkjihgfedcba . . . edcba dcba cba ba a

30th Mar 2020, 10:44 PM
Diego Becerril
Diego Becerril - avatar
6 Answers
+ 2
Something like this 👇 String s = "zywvtsrqponmlkjihgfedcba"; int len = s.length(); for(int i = 0; i < len; i++) { for(int j = i; j < len; j++) { System.out.print(s.charAt(j)); } System.out.println(); } (Edit) Someone asked the same question just today. Check the following thread https://www.sololearn.com/Discuss/2220519/?ref=app
31st Mar 2020, 1:23 AM
Ipang
+ 2
You can achieve that by using nested for-loop. Outer loop <i> goes from zero to string length - 1. Inner loop <j> goes from <i> to string length - 1. Print character at index <j> within the inner loop. And insert a new line character after the inner loop to separate the lines 👍
31st Mar 2020, 1:05 AM
Ipang
+ 2
No problem Diego Becerril 👌
31st Mar 2020, 1:41 AM
Ipang
+ 1
Ipang can you put the exaple please? thank you
31st Mar 2020, 1:16 AM
Diego Becerril
Diego Becerril - avatar
+ 1
thank you soooooo much, you save meeee 🤩
31st Mar 2020, 1:29 AM
Diego Becerril
Diego Becerril - avatar
0
Thanks, but i’m actually searching the answer without any method or function, just with the main
31st Mar 2020, 12:31 AM
Diego Becerril
Diego Becerril - avatar