Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Beaya10
- {
- static Scanner in = new Scanner(System.in);
- public static void main()
- {
- int n = 0;
- int c = 0;
- int a = 0;
- int b = 0;
- System.out.println("Please insert a number and press enter");
- n = in.nextInt();
- b = n;
- while (n!=0)
- {
- c++;
- n = n/10;
- }
- //System.out.println(c);
- int[] x = new int[c];
- while (a != c)
- {
- x[a] = b%10;
- b = b/10;
- System.out.println("x["+a+"] = " + x[a]);
- a++;
- }
- a = 0;
- int max;
- int min;
- while (a<c);
- {
- max = Math.max(x[a],x[a+1]);
- a++;
- }
- System.out.println(max);
- }
- }
Add Comment
Please, Sign In to add comment