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
Founder of television and Radio​
vredina [299]

Answer: <u>Charles Jenkins</u> was the founder of tele and radio.

Hope this helps!

4 0
3 years ago
Read 2 more answers
A browser is a program that allow
Snezhnost [94]

C. users to access and view web pages on the internet.

6 0
3 years ago
Select the correct term to complete the sentence.
Anna11 [10]

Answer:

its user interface

Explanation:

4 0
2 years ago
Write an expression that evaluates to true if the value of the integer variable numberOfPrizes is divisible (with no remainder)
Marianna [84]

Answer:

numberOfPrizes%numberOfParticipants==0

Explanation:

  • Above expression includes % sign, which means mod.
  • Mod of a value with another makes the 1st value divide by 2nd and return the remainder.
  • As numberOfParticipants cant be zero (given), the answer must be a proper number.
  • If numberOfPrizes is completely divisible by numberOfParticipants then it will return 0 as shown in above expression. True case.
  • If a digit other than 0 is a result then it will be false.
5 0
3 years ago
What does copyright and trademark both have in common
Marina CMI [18]

copyright is the exclusive legal right, given to an originator or an assignee to print, publish, perform, film, or record literary, artistic, or musical material, and to authorize others to do the same.  

trade mark is A trademark, trade mark, or trade-mark is a recognizable sign, design, or expression which identifies products or services of a particular source from those of others, although trademarks used to identify services are usually called service marks.

4 0
4 years ago
Other questions:
  • Which function in Spell Checker should Patrick use if he makes the same mistake frequently when typing emails?
    11·1 answer
  • What is virtual memory?
    11·1 answer
  • If a user has one column in a table and would like to make it into two columns which command should be used?
    8·2 answers
  • Some careers emerge to address the environmental impact human behaviors and processes might be having on our planet. True False
    9·2 answers
  • Which tab should gemima use to open the formula dialog box
    13·2 answers
  • Documenting Business Requirements helps developers control the scope of the system and prevents users from claiming that the new
    13·1 answer
  • What will happen when you run this program?
    12·2 answers
  • For what specific purpose is the TM9400 P25 Mobile designed? What is the benefit of having a mobile communications device that a
    10·1 answer
  • In the computing environment the numerical value represented by the pre-fixes kilo-, mega-, giga-, and so on can vary depending
    5·1 answer
  • SOMEONE HELP 60 POINTS!!!!! When creating business publications, these two factors must be determined before planning the layout
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!