Recently in Zhejiang University Onge Teacher's "Introduction to Programming-C language" class, Weng teacher that rich male charm of the magnetic voice deeply attracted me .... Although I am a man. The first week of the course has a quiz:
Topic content:
The program reads a positive three-digit number each time, and then outputs the number in reverse order. Note that when the input number contains the end of 0 o'clock, the output should not have a leading 0. For example, enter 700 and the output should be 7.
Input format:
Each test is a 3-bit positive integer.
Output format:
The number of output reverse order.
Input Sample:
123
Sample output:
321
Difficult, soon wrote out, online submitted the test passed, code as follows, write on the blog to stay as a souvenir, easy to see later.
PS: Do not know whether this is appropriate, Onge teacher don't blame me ...
#include <stdio.h>intMain () {intNUM1; scanf ("%d",&NUM1); intnum2; inta=num1/ -; intB= (num1-a* -)/Ten; intC=num1-(A * -+b*Ten); Num2=c* -+b*Ten+A; printf ("%d", num2); return 0;}
Three-digit C language implementation in reverse order