Home > Backend Development > C++ > How to express tens of thousands in C language

How to express tens of thousands in C language

下次还敢
Release: 2024-05-02 18:15:25
Original
592 people have browsed it

In C language, the way to express tens of thousands is: (1) Divide the number by 10000 to get the integer part; (2) Use the % remainder operator to take the remainder of the division result to 10000 to get tens of thousands. bit value.

How to express tens of thousands in C language

How to express tens of thousands in C language

In C language, the way to express tens of thousands is to use % Remainder operator and division by 10000 operation.

Specific steps:

  1. Divide the number by 10000 to get an integer part.
  2. Use the % remainder operator to take the remainder of the division result to 10000 to obtain a value in the tens of thousands.

Code Example:

<code class="c">int number = 123456;
int thousand_digit = number / 10000;
int thousand_digit_remainder = number % 10000;</code>
Copy after login

In the above example, the thousand_digit variable will store the integer part 12, while the thousand_digit_remainder The variable will store the tens of thousands value 3456.

The above is the detailed content of How to express tens of thousands in C language. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template