Advertisement
476179

NestedStatments3

Oct 24th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. package activities;
  2. import java.util.Scanner;
  3. public class NestedStatmentsAct3
  4. {
  5.  
  6. public static void main(String[] args)
  7. {
  8. Scanner keyboard = new Scanner(System.in);
  9.  
  10. int x;
  11.  
  12. System.out.print("enter a whole number between 1-10(inclusive): ");
  13. x = keyboard.nextInt();
  14.  
  15. if (x == 1)
  16. {
  17. System.out.println("I");
  18. }
  19. else
  20. {
  21. if(x == 2)
  22. {
  23. System.out.println("II");
  24. }
  25. else
  26. {
  27. if(x==3)
  28. {
  29. System.out.println("III");
  30. }
  31. else
  32. {
  33. if (x == 4)
  34. {
  35. System.out.println("IV");
  36. }
  37. else
  38. {
  39. if(x == 5)
  40. {
  41. System.out.println("V");
  42. }
  43. else
  44. {
  45. if(x == 6)
  46. {
  47. System.out.println("VI");
  48. }
  49. else
  50. {
  51. if (x == 7)
  52. {
  53. System.out.println("VII");
  54. }
  55. else
  56. {
  57. if(x == 8)
  58. {
  59. System.out.println("VIII");
  60. }
  61. else
  62. {
  63. if(x == 9)
  64. {
  65. System.out.println("IX");
  66. }
  67. else
  68. {
  69. if(x==10)
  70. {
  71. System.out.println("X");
  72. }
  73. else
  74. {
  75. System.out.println("error");
  76. }
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. }
  84. }
  85. }
  86. keyboard.close();
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement