Question: Develop a C# console appliation that asks the user to enter an unspecified number of int inputs and then displays a message stating the number

Develop a C# console appliation that asks the user to enter an unspecified number of int inputs and then displays a message stating the number of inputs received and showing the odd values in one output line and then the even values in one output line (as shown).

The application must input the values from the keyboard using the private static method IEnumerable GetValues() which gets an input from the keyboard and yield returns it into the sequence. If the user enters a value that is not an int, the method must yield break to terminate the sequence. Ensure that the application only asks the user to enter the inputs once.

Use an IEnumerable filter to filter the sequence for the odd values and then another IEnumerable filter to filter the sequence for the even values. Use the query body syntax ( from where select ) and assign the delayed execution sequence of each to a variable. E.g.

IEnumerable oddNumbers = from

and then use a foreach to interate through the odd numbers sequence and display the values to the console. E.g.

foreach(int oddNumber in oddNumbers)

and another foreach to iterate through the even numbers sequence and display the values to the console.

The input and output should look something like:

Please enter an int value. Press ENTER alone to quit: 55 Please enter an int value. Press ENTER alone to quit: 18 Please enter an int value. Press ENTER alone to quit: 47 Please enter an int value. Press ENTER alone to quit: 33 Please enter an int value. Press ENTER alone to quit: 106 Please enter an int value. Press ENTER alone to quit: 17 Please enter an int value. Press ENTER alone to quit: 12 Please enter an int value. Press ENTER alone to quit: 99 Please enter an int value. Press ENTER alone to quit: You have entered 8 values. The odd values are: 55 47 33 17 99 The even values are: 18 106 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!