Home > Article > Backend Development > How to express numbers in tens of thousands in C language
In C language, division and remainder operators are required to represent numbers in the tens of thousands place: 1. Divide by 10,000 to get the number in the tens of thousands place, and discard the remaining numbers. 2. Take the remainder 10 from the result to get the number in the tens of thousands place, discarding the higher order numbers.
How to express numbers in the tens of thousands place
In C language, to express numbers in the tens of thousands place, You need to use the remainder operator (%) and the division operator (/).
Steps:
Example:
To get the tens-thousands digit of the number 54,321, you can use the following code:
<code class="c">int num = 54321; int thousands_digit = (num / 10000) % 10; printf("万位上的数字:%d\n", thousands_digit);</code>
Output:
<code>万位上的数字:5</code>
Note:
abs(num / 10000) % 10
. The above is the detailed content of How to express numbers in tens of thousands in C language. For more information, please follow other related articles on the PHP Chinese website!