int value = 123;
while (value > 0) {
int digit = value % 10;
// do something with digit
value /= 10;
}
More Related Contents:
- Find the Biggest Number in C, BUT with characters
- Not able to calculate in C.How do you calculate in C?
- How to sum the digits of a number using Recursion [C]? [closed]
- What is the behavior of integer division?
- The most efficient way to implement an integer based power function pow(int, int)
- Undefined reference to `sin` [duplicate]
- How do I determine the number of digits of an integer in C?
- Divide a number by 3 without using *, /, +, -, % operators
- Explain this snippet which finds the maximum of two integers without using if-else or any other comparison operator?
- Fastest way to clamp a real (fixed/floating point) value?
- How to use nan and inf in C?
- Using M_PI with C89 standard
- How do you print the EXACT value of a floating point number?
- How to extract the decimal part from a floating point number in C?
- Representing integers in doubles
- Does “n * (rand() / RAND_MAX)” make a skewed random number distribution?
- Compute fast log base 2 ceiling
- How to concatenate two integers in C
- C – How to implement Set data structure?
- Octal number literals: When? Why? Ever? [closed]
- C: How to wrap a float to the interval [-pi, pi)
- Show a leading zero if a number is less than 10 [duplicate]
- log2 not found in my math.h?
- C++ – how to find the length of an integer
- Intersection of two lines defined in (rho/theta ) parameterization
- Why is the behavior of the modulo operator (%) different between C and Ruby for negative integers?
- Are the character digits [‘0’..’9′] required to have contiguous numeric values?
- Evaluate Mathematical Function from String [closed]
- Conditional tests in primality by trial division
- How sqrt() of GCC works after compiled? Which method of root is used? Newton-Raphson?