galinyotsev123

ProgBasicsJavaBook3.1SimpleConditions05Number0to9toText

Jan 22nd, 2019
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int num = Integer.parseInt(scanner.nextLine());
  8.  
  9. if (num == 1) {
  10. System.out.println("one");
  11. }
  12. else if (num == 2) {
  13. System.out.println("two");
  14. }
  15. else if (num == 3) {
  16. System.out.println("three");
  17. }
  18. else if (num == 4) {
  19. System.out.println("four");
  20. }
  21. else if (num == 5) {
  22. System.out.println("five");
  23. }
  24. else if (num == 6) {
  25. System.out.println("six");
  26. }
  27. else if (num == 7) {
  28. System.out.println("seven");
  29. }
  30. else if (num == 8) {
  31. System.out.println("eight");
  32. }
  33. else if (num == 9) {
  34. System.out.println("nine");
  35. } else {
  36. System.out.println("number too big");
  37. }
  38.  
  39.  
  40. }
  41. }
Add Comment
Please, Sign In to add comment