answersLogoWhite

0

Use an enum if you are using a c style language. Or a map data structure. Assign each integer an English value and then match it to what the user inputs.

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

How do you write a visual basic program to sum the odd number digits of a 12 digit code using division and Mod and while loops?

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


What is the formula that would get the tenths digit number in a three digit integer number?

In a three digit integer number the tenthsdigit is always 0 as integer numbers are whole numbers and have no decimal part and tenths are decimal parts:tenths_digit_of_integer_number = 0I suspect you mean "How to find the tens digit of an integer number?"; this is the second from the right, so:tens_digit = (INT(number ÷ 10)) MOD 10For example, in C this would become: tens_digit = (number / 10) % 10;


Write a java program to print the last digit in Fibonacci series?

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.


How to write a java program to extract the last digit from the input?

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.


How do you write a program in qbasic to input 64751315 to sum?

In QBASIC, you can write a simple program to input the number 64751315 and sum its digits as follows: DIM sum AS INTEGER sum = 0 INPUT "Enter a number: "; number FOR i = 1 TO LEN(number) sum = sum + VAL(MID$(number, i, 1)) NEXT PRINT "The sum of the digits is "; sum This program prompts the user to input a number, iterates through each digit, converts it to an integer, and adds it to the total sum, which is then printed out.

Related Questions

What is a program to accept a 3 digit integer and display its octal conversion value?

public class PrintOctal { public static void main(String[] args) { int n = Integer.parseInt(args[0]); System.out.printf("%o\n", n); } }


How do you write a visual basic program to sum the odd number digits of a 12 digit code using division and Mod and while loops?

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


How do you Write a program that determines the number of occurrences of each digit in a given integer n?

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);


What is the sum of largest 4-digit positive integer and smallest 3-digit negative integer?

1


What is an integer digit?

dvve evd


What is the smallest three digit?

The smallest three digit integer is 100


What is the sum of smallest and largest 5 digit whole number?

The smallest 5 digit integer is -99999. The largest 5 digit integer is 99999. The sum is therefore 0.


What is the number of a two digit positive integer?

A two-digit positive integer ranges from 10 to 99. It consists of a tens digit and a units digit, with the tens digit being at least 1. Thus, there are a total of 90 two-digit positive integers.


If the digits 7 8 2 3 and 0 are used each exactly once to form a three-digit positive integer and a two-digit positive integer that differ by exactly 288 what is the sum of the three-digit integer and?

Let the three-digit integer be ( x ) and the two-digit integer be ( y ). According to the problem, ( x - y = 288 ), which implies ( x = y + 288 ). The digits used are 7, 8, 2, 3, and 0. After testing possible combinations, the solution is ( x = 782 ) and ( y = 494 ). Therefore, the sum of the three-digit integer ( x ) and the two-digit integer ( y ) is ( 782 + 494 = 1276 ).


What is the value of the unit digit 12.04?

The unit digit of a number is the digit in the ones place, which is the integer part of the number. In the case of 12.04, the integer part is 12, and the unit digit is 2. Therefore, the value of the unit digit in 12.04 is 2.


What program can read n number must contain four- digits only and if the second left digit odd put it in an array if not ignore it?

Input the number as a string. If the string has a length of 4 and contains only digits, convert the string to an integer. If the integer is less than 1000, input another number. Otherwise, copy the integer and divide by 100 to get rid of the two least-significant digits. Divide again by 2 and take the remainder. If the remainder is 1 then the second left digit of the 4-digit integer is odd and the 4-digit integer can be added to the array, otherwise do not add it. Repeat for all n numbers.


Is a decimal integer?

A decimal number can be an integer. All that decimal means is that the place value of each digit is ten times that of the digit to its right.