Wuhan University of Science and technology acm:1003:0 start-up algorithm 14--three-digit inversion

Source: Internet
Author: User

Problem Description

Water problem

Input

Enter a 3-digit number (the title contains multiple sets of test data)

Output

Separates the 3-digit hundred, 10-bit, and single-digit, inverted output (one row of test data per group)

Sample Input

250

Sample Output

052

HINT

Separating out the numbers, you can use the remainder and the divisor.

Note that in C, 2 integers are multiplied except for the result or integer, such as 8/3 in the C language, and the result is 2.

Use symbol% for remainder

For example, the result of 8%3 should be 2 or 8 divided by 3 after the remainder.

1#include <stdio.h>2 3 intMain ()4 5 {6 7          intsplitint,one,ten,hundred;8 9         Ten  One           while(SCANF ("%d", &splitint)! =EOF) A  -          {                 -  thehundred = splitint/ -; -  -Ten = splitint% -/Ten;  -  +one = splitint%Ten;  -  +printf"%d%d%d\n", one,ten,hundred);  A  at          }        -  -          return 0; -  -}

Other code:

1#include <stdio.h>2 intMain ()3 {4     intn,m;5      while(SCANF ("%d", &n)! =EOF)6     {7          while(n>0)8         {9m=n%Ten;TenN/=Ten; Oneprintf"%d", m); A         } -printf"\ n"); -     } the     return 0; -}

Wuhan University of Science and technology acm:1003:0 start-up algorithm 14--three-digit inversion

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.