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
A​ ________ is a component in the computer system data hierarchy that includes content such as Student ID​ 100; Course IS​ 101,
julsineya [31]

Answer:

Field

Explanation:

A field is a component of the computer system hierarchy that includes content such as Student ID 100, Course IS​ 101, and Grade A field can also be defined as a grouping of characters that are used to represent a characteristic or attribute of an entity , in this case the entity being a student. In the computer system data hierarchy system we move from the field to  a record , A record is a collection of attributes of a given entity .When we have a group of related records we then come up with files and eventually get to our main source of data which is the database .It's function is to logically arrange a collection of related files for easier access and allows these files to be accessed by a number of applications .

8 0
4 years ago
Sean is studying at a friend's house and notices that he can connect to the wireless network without entering a wireless network
polet [3.4K]
It is a personal network of Sean’s friends family’s
5 0
3 years ago
In an average case involving an array of n elements, how many times will a sequential search function have to read the array to
Strike441 [17]

Answer:

n/2 times

Explanation:

The number of times  a sequential search function will have to read the array in other to locate a specific value is : n/2 times

In an average case to locate a specific value using the a sequential/linear search the elements of the array will be searched in other to get a specific value and this will take n/2 number of attempts/times.

a sequential search is used to search for a value contained in a data set that has a linear relationship with other values contained in the data set

3 0
4 years ago
a bus is full of passengers. if you count them by either twos, threes, or fives, there is one left. if you count them by seven t
ruslelena [56]

Answer:

91

Explanation:

You know that the number must end in 6 or 1 to get a left over of 1 when divided by 5. Six won't work because  2  divides evenly into a number ending into 6.

So the number ends in 1.

21 doesn't work because 3 divides into 21 evenly.

31 doesn't work because 7 does not divide into it.

41 doesn't work. 41 is prime. 7 won't divide into it.

51 is divisible by 3

61 seven does not evenly divide into 61.

71 seven leaves a remainder of  1

81 7 leaves a remainder.

91 Answer

4 0
3 years ago
Which keyboard shortcut can you use to access the go to feature, which will allow you to move quickly to another location in the
I am Lyosha [343]

The keyboard shortcut can you use to access the go to feature, which will allow you to move quickly to another location in the document  is  Ctrl+G or F5.

<h3>What is a keyboard shortcut?</h3>

Keyboard shortcuts are known to be keys or a set of combination of keys that a person can press on one's keyboard to carry out a specified tasks.

By using keyboard shortcuts , one is often often faster than using a mouse  and  to see the option you are looking for, you have to press Ctrl+G or F5.

Learn more about keyboard shortcut  from

brainly.com/question/12531147

8 0
2 years ago
Other questions:
  • What is heat sink?what is its use?If it is not in the system what will happen?
    12·1 answer
  • An email address is made up of all of the following parts except
    13·2 answers
  • A smartphone user entered an incorrect passcode on his phone several times in a row, which locked the device.
    5·1 answer
  • Now suppose that the file is broken into 5 packets, each of 10 Mbits. Ignore headers that may be added to these packets. Also ig
    14·1 answer
  • Agent Hunt is transferring classified files from the CIA mainframe into his flash drive. SSS represents the size of the files on
    12·1 answer
  • Identify a true statement about a flat file system. a. Data in a flat file system can be updated efficiently. b. Data in a flat
    9·1 answer
  • In an all-integer linear program,
    10·1 answer
  • Which user characteristic may not be used to change keyword bids in adwords?:?
    11·1 answer
  • Create a new Java class called AverageWeight. Create two arrays: an array to hold 3 different names and an array to hold their w
    13·1 answer
  • Pick the correct statements on the 64-bit machine representation of numbers.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!