Home > Back-end >  Freshmen enter a number 1-99, the output of its studying law (Chinese characters) output,
Freshmen enter a number 1-99, the output of its studying law (Chinese characters) output,

Time:06-11

C language freshmen enter a number 1-99, the output of its studying law (Chinese characters) output, if the input integer are beyond the scope of 1-99, print "input error!"
Don't use a for loop haven't learn don't define an array is best to use simple expression is not too complicated because just learning c language just learn while loop at the back of the haven't learned
For the brothers
Below this page just learning knowledge, on the edge of the best here thank you

CodePudding user response:

Do you have any brother for help

CodePudding user response:

Homework? Oneself read a book!
Only hint a 1-99 Chinese law, which can be roughly divided into 3 cases
1-10 YI, ER, SAN,... SHI
11-19 SHI YI, SHI ER,...
21-99 - ER SHI YI,... , JIU SHI JIU

CodePudding user response:

This can be used while... ????? If!

CodePudding user response:

#include Int main (void) {int a, b, num; Printf (" please enter a numerical value: "); The scanf (" % d ", & amp; Num); A=num/10; B=num - a * 10; if(num>=1 & amp; & Num<=99) {if (a>=1 & amp; & A<{=9) switch (a) case 0: printf (" \ n "); break; Case 1: printf (" yishi "); break; Case 2: printf (" ershi "); break; Case 3: printf (" sanshi "); break; Case 4: printf (" sishi "); break; Case 5: printf (" wushi "); break; Case 6: printf (" liushi "); break; Case 7: printf (" qishi "); break; Case 8: printf (" bashi "); break; Case 9: printf (" jiushi "); break; } the if (b>=1 & amp; & B<{switch=9) (b) case 1: printf (" yi \ n "); break; Case 2: printf (" er \ n "); break; Case 3: printf (" SAN \ n "); break; Case 4: printf (" si \ n "); break; Case 5: printf (" wu \ n "); break; Case 6: printf (" liu \ n "); break; Case 7: printf (" qi \ n "); break; Case 8: printf (" ba \ n "); break; Case 9: printf (" jiu \ n "); break; }} else printf (" input error! \n"); return 0; }

CodePudding user response:

reference 4 floor qq_45836904 response:
# include Int main (void) {int a, b, num; Printf (" please enter a numerical value: "); The scanf (" % d ", & amp; Num); A=num/10; B=num - a * 10; if(num>=1 & amp; & Num<=99) {if (a>=1 & amp; & A<{=9) switch (a) case 0: printf (" \ n "); break; Case 1: printf (" yishi "); break; Case 2: printf (" ershi "); break; Case 3: printf (" sanshi "); break; Case 4: printf (" sishi "); break; Case 5: printf (" wushi "); break; Case 6: printf (" liushi "); break; Case 7: printf (" qishi "); break; Case 8: printf (" bashi "); break; Case 9: printf (" jiushi "); break; } the if (b>=1 & amp; & B<{switch=9) (b) case 1: printf (" yi \ n "); break; Case 2: printf (" er \ n "); break; Case 3: printf (" SAN \ n "); break; Case 4: printf (" si \ n "); break; Case 5: printf (" wu \ n "); break; Case 6: printf (" liu \ n "); break; Case 7: printf (" qi \ n "); break; Case 8: printf (" ba \ n "); break; Case 9: printf (" jiu \ n "); break; }} else printf (" input error! \n"); return 0; }

Format, and I forgot to adjust yourself to look at! I think should be like this

CodePudding user response:

reference 5 floor qq_45836904 reply:
Quote: refer to 4th floor qq_45836904 response:
# include Int main (void) {int a, b, num; Printf (" please enter a numerical value: "); The scanf (" % d ", & amp; Num); A=num/10; B=num - a * 10; if(num>=1 & amp; & Num<=99) {if (a>=1 & amp; & A<{=9) switch (a) case 0: printf (" \ n "); break; Case 1: printf (" yishi "); break; Case 2: printf (" ershi "); break; Case 3: printf (" sanshi "); break; Case 4: printf (" sishi "); break; Case 5: printf (" wushi "); break; Case 6: printf (" liushi "); break; Case 7: printf (" qishi "); break; Case 8: printf (" bashi "); break; Case 9: printf (" jiushi "); break; } the if (b>=1 & amp; & B<{switch=9) (b) case 1: printf (" yi \ n "); break; Case 2: printf (" er \ n "); break; Case 3: printf (" SAN \ n "); break; Case 4: printf (" si \ n "); break; Case 5: printf (" wu \ n "); break; Case 6: printf (" liu \ n "); break; Case 7: printf (" qi \ n "); break; Case 8: printf (" ba \ n "); break; Case 9: printf (" jiu \ n "); break; }} else printf (" input error! \n"); return 0; }

Format, and I forgot to adjust yourself to look at! I think should be
good thank you??

CodePudding user response:

refer to 6th floor qq_45839954 response:
Quote: refer to the 5 floor qq_45836904 response:
Quote: refer to 4th floor qq_45836904 response:
# include Int main (void) {int a, b, num; Printf (" please enter a numerical value: "); The scanf (" % d ", & amp; Num); A=num/10; B=num - a * 10; if(num>=1 & amp; & Num<=99) {if (a>=1 & amp; & A<{=9) switch (a) case 0: printf (" \ n "); break; Case 1: printf (" yishi "); break; Case 2: printf (" ershi "); break; Case 3: printf (" sanshi "); break; Case 4: printf (" sishi "); break; Case 5: printf (" wushi "); break; Case 6: printf (" liushi "); break; Case 7: printf (" qishi "); break; Case 8: printf (" bashi "); break; Case 9: printf (" jiushi "); break; } the if (b>=1 & amp; & B<{switch=9) (b) case 1: printf (" yi \ n "); break; Case 2: printf (" er \ n "); break; Case 3: printf (" SAN \ n "); break; Case 4: printf (" si \ n "); break; Case 5: printf (" wu \ n "); break; Case 6: printf (" liu \ n "); break; Case 7: printf (" qi \ n "); break; nullnullnullnullnullnullnullnullnullnull