As the name implies, the return number is a type of number. The forward and reverse reads are completely consistent. For example, 12321,4567654 indicates the number of input files.
It is very easy to use the C language to determine the number of input files. Here, I will give a brief introduction.
First, use a judgment statement. The judgment statement is to find the reverse read data of the number through a loop and a simple operator, and then compare it with itself.
The Code is as follows:
# Include <stdio. h> void main () {int num; scanf ("% d", & num); int min = 0, max = num; while (max> 0) {min = min * 10 + max % 10; max = max/10;} If (min = num) printf ("Number of input files \ n "); else printf ("not the number of replies \ n ");}
The preceding code can be used to determine the number of input records within the int type range. However, if the length exceeds its range, another method is required. Use the string method.
I will not talk about it much, but I will directly look at the code:
# Include <stdio. h> void main () {char STR [100]; scanf ("% s", STR); int I = 0, j = 0; int K = 1; while (STR [J]! = '\ 0') J ++; while (k) {If (STR [I]! = STR [J-1]) {k = 0; printf ("this number is not the number of input! \ N "); break;} if (I = j | j-I = 1) {k = 0; printf (" this number is the number of replies! \ N "); break;} I ++; j --;}}
This program can determine the number of input strings of any length. However, this also has a defect, that is, if the input is not a number, it will also be judged. This is a flaw.
In fact, the number of replies is really simple, so we don't need to write them out. But after all, it is something I learned. let's just use it as a witness to my own learning!