daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2. public class Beaya10
  3. {
  4.  
  5. static Scanner in = new Scanner(System.in);
  6. public static void main()
  7. {
  8. int n = 0;
  9. int c = 0;
  10. int a = 0;
  11. int b = 0;
  12. System.out.println("Please insert a number and press enter");
  13. n = in.nextInt();
  14. b = n;
  15. while (n!=0)
  16. {
  17. c++;
  18. n = n/10;
  19. }
  20. //System.out.println(c);
  21. int[] x = new int[c];
  22. while (a != c)
  23. {
  24. x[a] = b%10;
  25. b = b/10;
  26. System.out.println("x["+a+"] = " + x[a]);
  27. a++;
  28. }
  29. a = 0;
  30. int max;
  31. int min;
  32. while (a<c);
  33. {
  34. max = Math.max(x[a],x[a+1]);
  35. a++;
  36. }
  37. System.out.println(max);
  38. }
  39. }
RAW Paste Data
Top