Home > Back-end >  How to write the input 123 output of 123 in Chinese?
How to write the input 123 output of 123 in Chinese?

Time:04-30


How to write the input 123 output of 123 in Chinese?


 import Java. Util. Scanner; 

Public class Test1 {

Public static void main (String [] args) {
//TODO Auto - generated method stub
System. The out. Println (" please enter a number: ");
Scanner input=new Scanner(System.in);
String count=input. Next ();
for(int i=0; i<=count. Length () - 1; I++) {
{if (count=="0")
System. The out. Println (" zero ");
} else if (count=="1") {
System. The out. Println (" a ");
} else if (count=="2") {
System. The out. Println (" 2 ");
} else if (count=="3") {
System. The out. Println (" three ");
} else if (count=="4") {
System. The out. Println (" four ");
} else if (count=="5") {
System. The out. Println (" 5 ");
} else if (count=="6") {
System. The out. Println (" six ");
} else if (count=="7") {
System. The out. Println (" 7 ");
} else if (count=="8") {
System. The out. Println (" eight ");
} else if (count=="9") {
System. The out. Println (" nine ");
}
Char ch=count. CharAt (I);
String STR=String. The valueOf (ch);
System. The out. Print (STR);
}

}

}

CodePudding user response:

Public static void main (String [] args) {
System. The out. Println (" please enter ");
Scanner scanner=new Scanner(System.in);
String next=scanner. The next ();
Char [] ch=next. ToCharArray ();
for (int i=0; I & lt;=ch. Length - 1; I + +) {
Int num=(int) ch [I] - (int) (' 0 ');
The switch (num) {
Case 1:
System. The out. Println (" a ");
break;
Case 2:
System. The out. Println (" 2 ");
break;
Case 3:
System. The out. Println (" three ");
break;
}
}
}
  • Related