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
Which building-block feature is available in the Text grouping on the Insert tab?
saveliy_v [14]

Answer:

Business information

Explanation:

The building blocks are durable objects for content like corporate material, headings, timetables, and gallery advertising. The user can retrieve and utilize the building blocks at any time. The user can also design, saves, categorize and enter a description of their own building blocks, and tag them with keywords to help them find easily. 

Business information is one of the main features of the building block galleries that is found on the insert tab in text group.

3 0
3 years ago
You were replying to e-mail when suddenly your computer started to display random messages, and stopped responding to keyboard a
Romashka-Z-Leto [24]
I think it’s A have no idea tho
7 0
3 years ago
Give 15 examples of copyright and trademarks that we come in contact with everyday. (Doesn't hve to be 15 could be 3 or 5) PLEAS
oksano4ka [1.4K]
Roads, trading, Government, water systems,
6 0
2 years ago
To insert a footnote in a document, a user would navigate to the _____ tab.
Pachacha [2.7K]

Answer

References tab.

Explanation

In MS word documents, you can add footnotes and endnotes by;

• Clicking the area to add a footnote

• Clicking references, then insert Footnote. The word program will insert a reference mark in the text and will add the footnote mark at the bottom of the page

• Type a footnote text.

Hope this Helps!

3 0
3 years ago
Read 2 more answers
While storms could be a cause, power______ are more likely to be caused by disturbances from high-demand equipment in a home or
Troyanec [42]

Answer:

outages

Explanation:

While storms could be a cause, power <u>outages</u> are more likely to be caused by disturbances from high-demand equipment in a home or building

8 0
2 years ago
Other questions:
  • I need help to find out what is wrong with this program and my variable, "exponent" comes out as 0 in the output instead of the
    14·1 answer
  • You are configuring two switches of different vendors such that they connect to each other via a single link that will carry mul
    13·1 answer
  • Print a countdown from n to 1 The function below takes one parameter: an integer (begin). Complete the function so that it print
    8·1 answer
  • Processors for most mobile devices run at a slower speed than a processor in a desktop PC.
    9·2 answers
  • Define the missing method. licenseNum is created as: (100000 * customID) licenseYear, where customID is a method parameter. Samp
    14·2 answers
  • Why is population composition by age important give reason​
    13·1 answer
  • Which screen should be open to customize or personalize a desktop background?
    15·2 answers
  • How do you render and export files on blender
    6·1 answer
  • _____ are fields that are used to personalize a mail merge document
    9·1 answer
  • If a person communicates indirectly and attaches little value to
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!