1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Viktor [21]
3 years ago
15

Write a program that prompts the user to enter a number then counts the number of odd numbers and even numbers the user enter. T

he program should exit if the user enter a zero or a number less than zero. For example, if the user enters 4, 7, 9, 8 21, 22, -1; upon entering -1 the program displays/output "3 even numbers and 3 odd numbers" were entered, then the program terminate
Computers and Technology
1 answer:
neonofarm [45]3 years ago
7 0

Answer:

The program written in Java is given in the explanation section

Explanation:

<em>import java.util.Scanner;</em>

<em>public class num3 {</em>

<em>    public static void main(String[] args) {</em>

<em>        Scanner in = new Scanner(System.in);</em>

<em>        System.out.println("This program counts evens and odds");</em>

<em>        System.out.println("To exit enter ZERO  or a NEGATIVE number");</em>

<em>        int num = in.nextInt();</em>

<em>        int numEvens=0;</em>

<em>        int numOdds = 0;</em>

<em>         while(num>=1){</em>

<em>             if(num%2==0){</em>

<em>              numEvens++;</em>

<em>             }</em>

<em>             else{</em>

<em>              numOdds++;</em>

<em>                }</em>

<em>             System.out.println("Enter the next number");</em>

<em>             num = in.nextInt();</em>

<em>            }</em>

<em>            System.out.println(numEvens+" even numbers and "+numOdds+" odd numbers");</em>

<em>    }</em>

<em>}</em>

You might be interested in
External hard drives typically connect to a computer via an external port (such as a usb or ____ port) or a wireless connection.
Marianna [84]

External hard drives typically connect to a computer via an external port (such as a USB or <u>thunderbolt</u> port) or a wireless connection.

<h3>What is a hard drive?</h3>

A hard drive can be defined as an electro-mechanical, non-volatile data storage device that is made up of magnetic disks (platters) that rotates at high speed.

In Computer technology, all hard drives are commonly installed on computers and other digital service for the storage of digital files and to enable the booting of a computer through its operating system (OS).

<h3>What is a memory?</h3>

A memory can be defined as a terminology that is used to describe the available space on an electronic device that is typically used for the storage of data or any computer related information such as:

  • Images
  • Videos
  • Texts
  • Music
  • Codes
  • Folders

In conclusion, all external hard drives typically connect to a computer through an external port such as a USB, <u>thunderbolt</u> port, or a wireless connection.

Read more on hard drive here: brainly.com/question/26382243

#SPJ1

8 0
1 year ago
why does planets orbit the sun? asap i give brainlist i know it on that subject i dont know what else goes with it
Fynjy0 [20]

Answer:

Anyway, the basic reason why the planets revolve around, or orbit, the Sun, is that the gravity of the Sun keeps them in their orbits. Just as the Moon orbits the Earth because of the pull of Earth's gravity, the Earth orbits the Sun because of the pull of the Sun's gravity.

Explanation:

7 0
3 years ago
In order for the image tag in an HTML file to function properly, the file named square.png must be located where?
andrey2020 [161]
A is wrong because a folder can have any name.
B is wrong because not all folders of a web server are exposed to the outside, only all folders below the document root.
C sounds good
D is wrong because an image can reside somewhere else as long as you specify the absolute or relative path to it
7 0
3 years ago
Read 2 more answers
Which statement describes what the Conditional Formatting option in Excel 2016 allows users to do?
jeyben [28]

Answer:

It automatically applies formatting based on specific rules or conditions being met. It automatically applies highlighting to selected cell ranges based on specific rules or conditions being met.

Explanation:

6 0
3 years ago
Read 2 more answers
Yan wants to attract customers specifically searching on Google for Time-B-Gone, his company's unique office-support product. Hi
ch4aika [34]

Answer:

The answer is "Option A".

Explanation:

The interactive background advertisements, that use advanced internet navigation technology from Google to dynamically resolve specific information demands based on the quality of a network page are also referred to as interactive search ads. This ads are good for tactics, and certain options were incorrect, that can be defined as follows:

  • In option B, It allows you easily access all other URLs of creative online ads.
  • In option C, It helps regulate operation in a machine.
  • In option D, It grows the internet traffic.
6 0
3 years ago
Other questions:
  • How can a network design project benefit from the principles of itsm? How might itsm impede a network design project?
    11·1 answer
  • What sends massive amounts of email to a specific person or system that can cause that user's server to stop functioning? mail b
    6·1 answer
  • What is runtime error in Python? Provide an example
    14·1 answer
  • Lenovo's ThinkPad laptop computers is designed in the United States, the case, keyboard, and hard drive are made in Thailand; th
    14·1 answer
  • Which practice is the safest way to sit at a desk while typing on the computer?
    12·1 answer
  • Computer privacy typically occurs when which of the following is violated?
    6·1 answer
  • An analog signal maintains a constant signal level for a period of time, then abruptly changes to a different constant level.
    5·2 answers
  • If you forget your privacy password what will you do if the ask this question what is the name of one of your teacher?​
    12·1 answer
  • Your organization has 20 employees who need an accounting software update installed. Due to a miscommunication, the purchaser on
    6·1 answer
  • To read encrypted data, the recipient must decipher it into a readable form. What is the term for this process?.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!