C # programming: given a positive integer, the number of digits is obtained and output in reverse order.
Step 1: Convert the input number to string n. toString () Step 2: Obtain the length of the string, that is, the number of digits of a positive integer. Step 3: output the code from the forward and backward: using System; using System. collections. generic; using System. linq; using System. text; // a positive integer. // required: 1. determine the number of digits. 2. Print the numbers in reverse order. Namespace ConsoleApplication3 {class Program {static void Main (string [] args) {int n = 12345; // first defines a positive integer string s = n. toString (); // convert the number into a string int weishu = s. length; // obtain the Length of the string, that is, the number of Console digits in the positive integer. writeLine ("the number of digits is {0} \ n", weishu); Console. write ("reverse output:"); for (int I = weishu-1; I> = 0; I --) {Console. write (s [I]); // output of one character from the back to the front} Console. read ();}}}