answersLogoWhite

0


Best Answer

Say you have some integer a. a

First take it's absolute value. |a|

Next log it base 10. log10 |a|

Truncate this value, then add 1. trunc ( log10 |a| ) + 1

You now have the number of digits.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: To count the no of digits in an integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Which is the smallest integer in two digits?

10OR 01 (if you count zero)


Can significant digits be written in a fraction form?

The significant digits of a number represent a count of digits and so are represented by an integer. Any integer can be written in fractional form.


Is 1212121212.... an integer?

If it ever ends, then it is.If there are no digits after the decimal point, it's an integer.


Is 3.5 a odd integer?

It is not an integer, since it has digits after the decimal point.


Sum of digits?

# include <stdio.h> main() { int num,count,sum; count=0; sum=0; printf("enter an integer :"); scanf("%d",&num); printf("ur num is : %d \n",num); while (num!=0) { count++; sum+=num%10; num/=10; } printf("sum of the digits is : %d",sum); }


Is 3.14 an integer?

Any number that has non-zero digits after the decimal point is NOT an integer.


Is 0.50 a integer number?

Any number that has non-zero digits after the decimal point is NOT an integer.


Digits of a given integer are equal or not?

More often they are not.


How do you make a program that counts how many times each digit occured in the integer?

To count the number of times a digit occurs in an integer, start by initializing an array of ten counts of digits, such as int digits[10];Then, in a loop while the number is non zero, increment the element in the digits array that corresponds to the units digit, and then divide the number by ten, such as digits[number%10]++ and number/=10;int digits[10];int i;int number = some number;for (i=0; i


Is 0.6666666667 an integer?

No; an integer is a number without decimal digits, or without a fractional part.


How do you count significant figures?

To count significant figures, you count all the non-zero digits. You also count zeros which are between non-zero digits, as well as zeros which are after the decimal point, only if they appear to the right of non-zero digits.


Is -3.14 a negative integer?

There are non-zero digits after the decimal point, so it is not an integer of any kind.