Count them unless the number has a recurring ending.
Repeatedly divide the number by 10 and store the remainder (the modulo). By way of an example, if the number were 12345: 12345 % 10 = 5 (first digit) 12345 / 10 = 1234 1234 % 10 = 4 (second digit) 1234 / 10 = 123 123 % 10 = 3 (third digit) 123 / 10 = 12 12 % 10 = 2 (fourth digit) 12 / 10 = 1 (fifth digit) This algorithm forms the basis of number reversals. The following function demonstrates the most efficient way of reversing any number in the range -2,147,483,648 to 2,147,483,647, inclusive. int RevNum( int num ) { const int base = 10; int result = 0; int remain = 0; do { remain = num % base; result *= base; result += remain; } while( num /= base); return( result ); }
/* program without if statement */ #include<stdio.h> #include<conio.h> void main() { int a,c; float b; clrscr(); printf("Enter the value \n"); scanf("%f",&b); a=c; c=a%10; printf("the right most digit is %d",c); getch(); }
#include <stdio.h> int main(void){ // Local Declerations int intNum; int midDigit; // Statements printf("Enter a 5 digit integral number: "); scanf("%d", &intNum); //the assignment expression below is used to calculate the mid digit oneDigit = (intNum % 1000) / 100; printf("\nThe middle digit is: %d", oneDigit); return 0; }
What elements of your job do you find most difficult
# Algo: # 1) Input number n # 2) Set rev=0, sd=0 # 3) Find single digit in sd as n % 10 it will give (left most digit) # 4) Construct revrse no as rev * 10 + sd # 5) Decrment n by 1 # 6) Is n is greater than zero, if yes goto step 3, otherwise next step # 7) Print rev # if [ $# -ne 1 ] then echo "Usage: $0 number" echo " I will find reverse of given number" echo " For eg. $0 123, I will print 321" exit 1 fi n=$1 rev=0 sd=0 while [ $n -gt 0 ] do sd=`expr $n % 10` rev=`expr $rev \* 10 + $sd` n=`expr $n / 10` done echo "Reverse number is $rev"
It is the most commonnly occurring number in a set of numbers. I.E. if a set is 1,2,3,2,5,6,2 the mode is 2.
It is the last (right most) digit of an integer. If the number has a decimal representation, it is the digit immediately to the left of the decimal point.
The leading digit in a number is the digit to the most left. EXAMPLES: 1.09 the leading digit is 1. 298 leading digit 2.
1 is the most used digit because of 100
The most common naturally occurring isotope of carbon is carbon-12, which has a mass number of 12.
a broom
the digit 0
The biggest 4 digit number that can be made from using the digits of 850236, using a digit at most once, is 8653.
The left most digit.
The smallest six-digit even number is 100,000
102345 is the smallest [positive] 6-digit number with no repeats.
Then the data doesn't have a mode.