C language Programming _ Zhejiang University--the 1th week of programming exercises _ three digits in reverse order

Source: Internet
Author: User

1 three digits in reverse order (5 points)

Topic content:

Three-digit number in reverse order:

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.

Hint: With%10 can get single digit, with/100 can get hundred number .... The three numbers that are obtained are combined: Hundreds *100+ 10 bits *10+, and the results are obtained.

Note: In addition to the output of the topic requirements, can not output any other content, such as input prompt, the output of the description and so on can not. This topic requires the output of reverse order number, the program can only output this number, in addition to any content can not be output.

Input format:

Each test is a 3-bit positive integer.

Output format:

The number of output reverse order.

Input Sample:

123

Sample output:

321

time limit: 500ms memory limit: 32000kb
1#include <stdio.h>2 intMain () {3     intinput=0;4scanf"%d",&input);5     inthundred=input/ -;6     intTen= (input/Ten)%Ten;7     intsingle=input%Ten;8     intnewnum=single* -+ten*Ten+Hundred;9printf"%d", newnum);Ten     return 0; One}

C language Programming _ Zhejiang University--the 1th week of programming exercises _ three digits in reverse order

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.