subject

Assignment 4: Evens and Odds Write a program that will ask a user for how many numbers they would like to check. Then, using a for loop, prompt the user for a number, and output if that number is even or odd. Continue doing this as many times as the user indicated. Once the loop ends, output how many even numbers were entered and how many odd numbers were entered.

Hint: For a number to be even, when the number is divided by 2, there should be no remainder - so you will want to use the modulus (%) operator.

Hint: You will need two count variables to keep track of odd and even numbers.

Sample Run 1
How many numbers do you need to check? 5
Enter number: 20
20 is an even number.
Enter number: 33
33 is an odd number.
Enter number: 4
4 is an even number.
Enter number: 77
77 is an odd number.
Enter number: 8
8 is an even number.
You entered 3 even number(s).
You entered 2 odd number(s).
Sample Run 2
How many numbers do you need to check? 3
Enter number: 10
10 is an even number.
Enter number: 3
3 is an odd number.
Enter number: 400
You entered 2 even number(s).
You entered 1 odd number(s).

Benchmarks
Prompt the user to answer the question, “How many numbers do you need to check? “
Create and initialize two count variables - one for odd and one for even.
Based on the previous input, create a for loop that will run that exact number of times.
Prompt the user to “Enter number: “
If that number is even, output “[number] is an even number.”
Update the even count variable.
Or else if the number is odd, output “[number] is an odd number.”
Update the odd count variable.
Output “You entered [number] even number(s).”
Output “You entered [number] odd number(s).”

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
Quic which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
You wanted to look up information about alzheimer's, but you were unsure if it was spelled "alsheimer's" or "alzheimer's." which advanced search strategy would be useful? a) a boolean search b) using a wild card in your search c) trying different search engines d) doing a search for "alsheimer's not alzheimer's" asap. ill give brainlist.
Answers: 1
question
Computers and Technology, 24.06.2019 00:20
Describe a data structures that supports the stack push and pop operations and a third operation findmin, which returns the smallest element in the data structure, all in o(1) worst-case time.
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Write the pseudo code for this problem based on what you learned from the video. the purpose is to design a modular program that asks the user to enter a distance in kilometers, and then converts that distance to miles. the conversion formula is as follows: miles = kilometers x 0.6214
Answers: 3
You know the right answer?
Assignment 4: Evens and Odds Write a program that will ask a user for how many numbers they would l...
Questions
question
Mathematics, 20.12.2019 04:31
question
Social Studies, 20.12.2019 04:31
Questions on the website: 13722360