+ 1

I cannot find the problem in my cod,can someone help me?

import java.util.Scanner ; public class Program { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); String var= scanner.Next(); char[] arr=varr.ToCharArray(); int c; for(c=arr.length; c>0;c--) { System.out.println(arr[c]); } } }

7th Jan 2021, 4:34 PM
Alexandra Badescu
Alexandra Badescu - avatar
2 Respostas
+ 1
// You have to read all more carefuly, quite much incorrect: import java.util.Scanner ; public class Program { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); String var= scanner.nextLine(); char[] arr=var.toCharArray(); int c; for(c=arr.length-1; c>=0;c--) { System.out.println(arr[c]); } } }
7th Jan 2021, 4:53 PM
JaScript
JaScript - avatar
+ 1
Thank You,i will be more careful.
7th Jan 2021, 4:54 PM
Alexandra Badescu
Alexandra Badescu - avatar