[C Language] three digits in reverse order, digits in reverse order in C Language

Source: Internet
Author: User

[C Language] three digits in reverse order, digits in reverse order in C Language

Bytes ----------------------------------------------------------------------------------------

// Main. c

// Demo8

// Created by weichen on 14/12/18.

// Copyright (c) 2014 weichen. All rights reserved.


# Include <stdio. h> int main () {int a = 0; printf ("input a three-digit number:"); scanf ("% d", & ); // In scanf, You need to input multiple numbers separated by spaces or commas. Otherwise, scanf reads the initial value int bai = a/100; // hundreds of digits int shi = a % 100/10; // ten digits int ge = a % 100% 10; // single digit printf ("the number after inverted order is: % d ", ge * 100 + shi * 10 + bai );}

Note: This question focuses on the idea of solving such problems, which should be split first and then combined.

 

@ Blackeye poet <www. chenwei. ws>

 

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.