Skip to content

Instantly share code, notes, and snippets.

@frdylmz
Created September 20, 2018 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frdylmz/fa3bc279be427ffef8dafedaa69d08e3 to your computer and use it in GitHub Desktop.
Save frdylmz/fa3bc279be427ffef8dafedaa69d08e3 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class numberToWords {
public static void main(String[] args) {
int number;
Scanner sc = new Scanner(System.in);
System.out.println(" Please enter a number between 1 and 10");
number = sc.nextInt();
switch (number){
case 1:
System.out.println("one");
break;
case 2:
System.out.println("two");
break;
case 3:
System.out.println("three");
break;
case 4:
System.out.println("four");
break;
case 5:
System.out.println("five");
break;
case 6:
System.out.println("six");
break;
case 7:
System.out.println("seven");
break;
case 8:
System.out.println("eight");
break;
case 9:
System.out.println("nine");
break;
case 10:
System.out.println("ten");
break;
default :
System.out.println("invalid number");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment