answersLogoWhite

0


Best Answer

Firstly you would need to get the user input and initialize some variables (This is all done in C#):

string text = Console.ReadLine();

int numberOfEven = 0;

int numberOfOdd = 0;

int numberOfZero = 0;

int number = 0;

Then you would need to loop through the string to see for the odd and even numbers:

while(number < text.Length) // Loops through how many times there are // numbers in the string

{

if (text[number] 0) // Just like the one before, checks if it is // odd

{

numberOfOdd ++;

}

number ++;

}

And you can print off each of the integers to get how many evens, odds and zeros there are.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago
  1. Create three accumulator variables for odd, even and zero and initialise them all to zero. Note that zero is an even value. If the input value is zero, jump to step 3.
  2. Divide the value by 10 and take the remainder (use the modus operator) to determine the least-significant digit. If it is odd, increment the odd accumulator, otherwise increment the even accumulator and, if the even number is zero, increment the zero accumulator. Now divide the value by 10 to shift all digits one place to the right (use integer division to ignore any fraction). If the number is still greater than zero, repeat the process.
  3. Finally, print the accumulators.
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you design and implement an application that determines and prints the number of odd even and zero digits in an integer value read from the keyboard?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What has the author E Balas written?

E. Balas has written: 'Discrete programming by the filter method with extension to mixed-integer programming and application to machine-sequencing' -- subject(s): Integer programming


How can Implement JAVA code which takes 2 dimensional integer array as input and prints out heaviest island?

public static void main (String args[]) throws IOException { int abc = System.in.read(); }


What is the largest integer and the largest floating-point number?

In real-world math, there is no "largest" integer or floating point number. This is covered by the concepts known as "infinity" and "irrationality." Depending on the processor and/or application, a number with significant digits into the thousands can be operated upon.


What does java int to string do?

As the full name states, it is an application that converts a number (integer) to a string. This allows you to do calculations at a faster pace, with less chance of errors.


What assigns the sum of two Integer variables named score1 and score2 to the Text property of the answerText-box The application contains the Option Strict On statement?

The answer follows.


Is -2 is not an integer?

No, it is an integer.


Write a function that reads an integer and determines and prints how many digits in the integer are 7s?

== == // Returns number of 7s in num. int numSevens(int num) { int _num = num; int numSevens = 0; while( _num &gt; 0 ) { if( (_num % 10) == 7 ) { ++numSevens; } _num /= 10; } return numSevens; }


How do you get the absolute value of positive integer?

The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.


Will the square of an integer always be an integer?

Yes, the square of an integer is always an integer.


Which statement is true the square root of an integer will always be an integer or the square of an integer will always be an integer?

the square of an integer will always be an integer


The square root of an integer will always be an integer?

The square root of an integer is a CYCLOTOMIC integer.


What is 1448 as an integer?

1448 is an integer.