0

please take a string code as input and put its reverse?!

convert to char array and do code by using arr.length

5th Nov 2022, 9:22 PM
mahdi
1 Answer
0
import java.util.*; public class Program { public static void main(String[] args) { String s; //s = "sololearn"; Scanner inp = new Scanner(System.in); s = inp.nextLine(); char[] cs = s.toCharArray(); for (int i=cs.length-1; i>=0; i--) System.out.print(cs[i]); } }
5th Nov 2022, 9:46 PM
SoloProg
SoloProg - avatar