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
elena55 [62]
3 years ago
5

Write a program segment with a do-while loop that displays whether a user-entered integer is even or odd. The code should then a

sk the user if he or she wants to test another number. The loop should repeat as long as the user enters 'Y' or 'y' . Use a logical OR operator in the do-while loop test expression
Computers and Technology
1 answer:
Leya [2.2K]3 years ago
5 0

Answer:

Following is the program in C++ program

#include<iostream> // header file

using namespace std; // namespace  

int main() // main function  

{

int num1 = 0; // variable declaration  

char test;// variable declaration  

do

{

cout << " Enter the number: ";

cin >> num1; //Read the input by the user  

if (num1 % 2 == 0) // check the condition of even

cout << " number is even.\n";

else // check the condition of odd

cout << "Number is odd.\n";

cout << " Do you wanted the another test of number (y/n)? ";

cin >> test; //Read the input by user

} while (test == 'y' || test == 'Y'); //terating the loop

return 0;    

}

Output:

Enter the number:45

number is even.

Do you wanted the another test of number (y/n) Y

Enter the number:5

Number is odd.

Do you wanted the another test of number (y/n) n

Explanation:

Following are the description of program

  • Declared a variable "num1" as integer type and initialized as 0 to them
  • Declared a variable "test" as char type .
  • After that iterating the do -while loop .Read the value by the user in the "num1" variable .
  • Check the condition of even and odd by using % operator .
  • Read the value of test by the user .If the user enter Y or y then loop again executing otherwise not .
You might be interested in
“Urban Populations” should fall under which sections of your organizer?
ELEN [110]

Answer:

a = TOPIC

Explanation:

4 0
3 years ago
Read 2 more answers
What will be the results of executing the following statements? x.setEditable(true); x.setText("Tiny Tim"); a. The text field x
maxonik [38]

Answer:

Option B: The text field x will have the value "Tiny Tim" and the user will be able to change its value.

Explanation:

  • The first statement say:  x.setEditable(true);

It will only change the property of the text present in x to editable. This means that whenever the text value needs to change the user can edit it.

  • The second statement say:   x.setText("Tiny Tim");

It will put the text "Tiny Tim" into the attribute x and present it as the output or result.

6 0
3 years ago
are designed to locate information based on the nature and meaning of Web content, not simple keyword matches Select one: a. Cra
san4es73 [151]

Answer: C. Semantic Search Engines

Explanation:

Semantic search is simply search with meaning. It is designed to locate information based on the nature and meaning of Web content, not simple keyword matches (like in lexical searches)

4 0
3 years ago
The a0 is the part of the central processing unit that performs arithmetic calculations for the computer.
Serga [27]

Answer:

It is the ALU or the Arithmetic Logic Unit.

Explanation:

It is the ALU. However, keep in mind that registers and buses do a very important task. The number of registers we have, faster is the processing, and the opposite is true as well. And there is a reason behind this if we have different channels for sending and receiving the data from the memory, and several registers for storing the data, and we can formulate the requirement seeing the requirements for full adder and half adders. Remember we need to store several variables in case of the full adder, and which is the carry, and if we have separate registers for each of them, our task becomes easier. Remember its the CU that tells the ALU what operation is required to be performed. Also remember we have the same channel for input and output in the case of Van Neumann architecture, as we have a single bus. and we also have a single shared memory. And Harvard architecture is an advanced version of it.

6 0
2 years ago
To move an icon, you right-click it and select “Pin to start menu.” True False
tester [92]

"To move an icon, you right-click it and select “Pin to start menu.” True False"

False

4 0
2 years ago
Read 2 more answers
Other questions:
  • Designing the moving parts of a car—including the engine, drivetrain, steering, and brakes—is done by what type of engineer?
    11·2 answers
  • The piece of hardware that contains the circuitry that processes the information coming in to the computer and tells the other h
    8·1 answer
  • How to connect xbox one controller
    5·1 answer
  • What are the differences, physically and logically, between the two printing configurations: Network-attached Printing and Netwo
    7·1 answer
  • Which composer below was not part of the classical period? <br> A. Beethoven B. Bach<br> C. Mozart
    6·1 answer
  • The signature area in a cover letter includes the sender's first and last name, followed by his/her job title (if applicable). *
    13·1 answer
  • A list is a collection that ______________
    9·1 answer
  • A task-oriented leader is ideal for a creative workplace.
    8·2 answers
  • Which of the following is true about named ranges?
    6·1 answer
  • 2. what are the advantages of breaking up a single logical message into a number of fixed-sized packets and then sending each on
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!