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
10. Calculate the checksum for blocks of data with the following byte sum. (a) 1220 (b) 950​
OLga [1]

Answer:kalo gk salah yang

a

Explanation:

5 0
3 years ago
A review of the sales, costs, and profit projections for anew product to find out whether these factors satisfy the company'sobj
soldier1979 [14.2K]

Answer: Business analysis

Explanation:

Business analysis is the review of the sales, costs, and profit projections for a new product to find out whether these factors satisfy the company's objectives.

Based on the business analysis a company is able to set a marketing strategy for a better promotion of its products. So this step is particularly very important.

7 0
3 years ago
What is the typical relationship between time and interest rate?
Hatshy [7]
The answer is A! Longer time period usually equals higher interest rate!
5 0
3 years ago
What is the difference between autofocus and autocomplete
Vladimir [108]

Answer:

https://www.c-sharpcorner.com/interview-question/explain-autofocus-and-autocomplete-attribute

found this on a website hope you find it useful !

8 0
3 years ago
What is the definition of podcast
Yanka [14]

a digital studio that is been live to all around the world

6 0
3 years ago
Other questions:
  • 1. You want to schedule a weekly analysis for the Windows servers in your data center. The command should run as a scheduled job
    15·1 answer
  • Write a Java method that will take a string and reverse it. Can you come up with a method that is faster than regular reversing
    7·1 answer
  • If you could make any blog, what would it be about and why?
    9·1 answer
  • One of the disadvantages of Audacity is that it has limited technical support since it is a free program.     true or false
    11·2 answers
  • F=M×A<br> What is the acceleration of 50kg object pushed with a force of 500 newton?
    14·1 answer
  • How computational thinking skills impact software design and the quality of the software applications produced?
    10·1 answer
  • PLEASE HELP ME I'M TIMED!!!!!!!!!!!!
    5·1 answer
  • If you were infiltrating a network (10.16.0.0/16), and searching for vulnerabilities (while trying to remain undetected), why wo
    11·2 answers
  • Which examples demonstrate common qualifications for Marketing Information Management and Research careers? Check all that apply
    9·2 answers
  • A proposal is also known as a
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!