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.
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.
It is not an integer, since it has digits after the decimal point.
# 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); }
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
There are non-zero digits after the decimal point, so it is not an integer of any kind.
10OR 01 (if you count zero)
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.
If it ever ends, then it is.If there are no digits after the decimal point, it's an integer.
It is not an integer, since it has digits after the decimal point.
# 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); }
Any number that has non-zero digits after the decimal point is NOT an 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
Any number that has non-zero digits after the decimal point is NOT an integer.
More often they are not.
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.
No; an integer is a number without decimal digits, or without a fractional part.
There are non-zero digits after the decimal point, so it is not an integer of any kind.