作业帮 > 综合 > 作业

output the corresponding word in English.Between1-9.

来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/08 03:22:08
output the corresponding word in English.Between1-9.
output the corresponding word in English.Between1-9.
public static void main(String[] args) {
String[] numsAry = {"zero","one","two","three","four","five","six","seven","eight","nine"};
Scanner scanner= new Scanner(System.in);
System.out.print("Please input a number between 1 and 9:");
int num = scanner.nextInt();
System.out.println(num + " to corresponding string is:" + numsAry[num]);
}
}