Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.print("Input a number: ");
- int n = in.nextInt();
- String s = "" + n;
- char[] ch = s.toCharArray();
- int indexOfMax = 0;
- for (int i = 1; i < ch.length; i++)
- {
- if (ch[i] > ch[indexOfMax])
- {
- indexOfMax = i;
- }
- }
- System.out.println(indexOfMax + " " );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement