+ 1
4 ответов
+ 3
You had if instead of for, lenght instead of length, length is a method so it needs (), and it returns the actual count of character so you need to -1.
+ 2
thanks
+ 1
i want to give the program a string like; MNB and the program give me back BNM
+ 1
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
String mm = new Scanner(System.in).nextLine();
for (int a = mm.length()-1;a !=-1;a--) {
System.out.println(mm.charAt(a));
}
}
}