Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.
The last digit in the number 'N' is
[ N ] minus { 10 times [ the greatest integer in (N/10) ] }.
Assuming you've entered a multi-digit number whole number (an integer), then take the modus (%) of the number and 10. E.g., if the number input was 1234, then 1234 % 10 is 4. Thus the final digit is 4. Note that modus 10 is the same as dividing the number by 10 and taking the remainder.
<script type = "text/javascript"> var input; var rev = 0; input=window.prompt ("Please enter a 5-digit number to be reversed."); input = input * 1; while (input > 0) { rev *= 10; rev += input % 10; input /= 10; } document.write ("Reversed number: " + rev); </script>
Function sum_odd_digits(ByVal number As Integer) As Integer Dim digit As Integer sum_odd_digits = 0 While number <> 0 digit = number Mod 10 If digit And 1 Then sum_odd_digits = sum_odd_digits + digit number = number / 10 End While End Function
hey..it s simple..make use of built-in function isdigit(character)..it s in stdlib.h...
The tricky part is getting the individual digits. There are basically two ways to do this: 1) Convert the number to a string, and use string manipulation to get the individual digits. 2) Repeatedly divide the number by 10. The digit is the remainder (use the "%" operator). To actually get the highest digit, initially assume that the highest digit is zero (store this to a variable, called "maxDigit" or something similar). If you find a higher digit, replace maxDigit by that.
Write a program to convert a 2-digit BCD number into hexadecimal
WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL
The first four-digit Fibonacci number is 1597 - equal to 610 + 987.
10946
He helped to popularize the 0-9 digit number, came up with the Fibonacci sequence and the sub-set of Fibonacci primes.
next number to this series is 554325. its look like this 15--add 1 to first digit and we get 2 and repeat two times and leave other digit.225 225-- its first digit is 2 and add 1 to it get 3 and write two time and write remaining digit as 3325. 3325-- its first digit is 3 and add 1 to it get 4 and write two time and write remaining digit as 44325. 44325-- its first digit is 4 and add 1 to it get 3 and write two time and write remaining digit as 554325.
Any single digit number is a palindrome. The Fibonacci sequence consists of infinitely many numbers so 8, being only one number, cannot be the Fibonacci sequence.
Write a program to convert a 2-digit BCD number into hexadecimal
there could be a part in it like this: int num, digit; int count [10]; do { digit = num%10; num != 10; ++count[digit]; } while (num);
Assuming you've entered a multi-digit number whole number (an integer), then take the modus (%) of the number and 10. E.g., if the number input was 1234, then 1234 % 10 is 4. Thus the final digit is 4. Note that modus 10 is the same as dividing the number by 10 and taking the remainder.
<script type = "text/javascript"> var input; var rev = 0; input=window.prompt ("Please enter a 5-digit number to be reversed."); input = input * 1; while (input > 0) { rev *= 10; rev += input % 10; input /= 10; } document.write ("Reversed number: " + rev); </script>
The smallest 5 digit number you can write is 10000.