2 read integers (5 points)
Topic content:
Your program is going to read an integer in the range [ -100000,100000]. Then, use Hanyu Pinyin to output each bit of this integer.
If you enter 1234, the output:
- Yi er san si
Note that there is a space between the pinyin for each word, but there is no space behind the last word. When a negative number is encountered, add "fu" at the beginning of the output, such as the 2341 output as:
- Fu er san si yi
Input format:
An integer that ranges from [ -100000,100000].
Output format:
The pinyin that represents each digit of the integer, with a space separating the pinyin for each digit, and no space at the end.
Input Sample:
-30
Sample output:
Fu San Ling
time limit: 500ms memory limit: 32000kb
1#include <stdio.h>2#include <math.h>3 Main ()4 {5 intx;6scanf"%d", &x);7 intCNT =0;8 intT;9 inty;Ten One if(X <0) A { -t =-x; - } the Elset =x; - - Do - { +t = t/Ten; -cnt++; +} while(T >0); A aty = Pow (Ten, (CNT-1)); - - if(X <0) - { -printf"Fu"); -t =-x; in } - Elset =x; to + Do - { the Switch(t/y) * { $ Case 0:p rintf ("Ling"); Break;Panax Notoginseng Case 1:p rintf ("Yi"); Break; - Case 2:p rintf ("er"); Break; the Case 3:p rintf ("San"); Break; + Case 4:p rintf ("si"); Break; A Case 5:p rintf ("Wu"); Break; the Case 6:p rintf ("Liu"); Break; + Case 7:p rintf ("Qi"); Break; - Case 8:p rintf ("BA"); Break; $ Case 9:p rintf ("JIU"); Break; $ } - if(Y >9) - { theprintf" "); - }Wuyit = t%y; they = y/Ten; -} while(Y >0); Wu}
Introduction to the design of NetEase cloud Classroom-C language _ Fourth week: Cyclic control _2 integer