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
alexgriva [62]
3 years ago
12

Write an algorithm that asks a user to enter a number between 1 and 10. (This range includes the numbers 1 and 10.) When they en

ter the number, check that it is actually between 1 and 10. If it is not, ask them to enter a number again. Continue to ask until they enter a valid number. Once their number is valid, output the number. (C++ form)
Computers and Technology
1 answer:
Nataliya [291]3 years ago
4 0

Answer:

do{

   cout<<"Introduce number \n"; //print the message

   cin>>num; //set the value of the number given

}while(num<1 || num>10); //repeat while the number is out of the range

cout<<"Number: "<<num; //print the number

Explanation:

The idea behind this code is to create a loop in which I can compare the number given  (between 1 and 10) and then print the number or get back and ask the number again.

#include <iostream>

using namespace std;

int main()

{

   int num; //create num variable

do

{

   cout<<"Introduce number \n"; //print the message

   cin>>num; //set the value of the number given

}while(num<1 || num>10); //repeat while the number is out of the range

cout<<"Number: "<<num; //print the number

}

You might be interested in
Hard drives have the largest capacity of any storage device. <br> a. True <br> b. False
VMariaS [17]
It's false as they store way lesser than we think
3 0
3 years ago
Read 2 more answers
Which protocol is used for secure websites? <br> FTP<br> HTTP<br> HTTPS<br> SFTP
givi [52]
HTTPS is the answer.
Hypertext transfer protocol secure
5 0
3 years ago
Varied amount of input data Statistics are often calculated with varying amounts of input data. Write a program that takes any n
Gnom [1K]

In Python 3.8:

nums = list(map(int, input("Enter your numbers space separated: ").split()))

print(f"The largest number is {max(nums)} and the average of all the numbers entered is {sum(nums)/len(nums)}")

7 0
3 years ago
A certain manager makes the following statement "Our internet company is in business for the money, making profits, and making t
julia-pushkina [17]

Answer:

d. Stockholder theory

Explanation:

The theory of maximising profits

8 0
4 years ago
You will create two classes, one for a box and one for a triangle. Each of the figures, the box and the triangle, will have an o
Softa [21]

I believe it should be

6 0
3 years ago
Other questions:
  • Which type of computing refers to firms purchasing computing power from remote providers and paying only for the computing power
    7·1 answer
  • In gaming, "rendering" refers to:
    12·2 answers
  • Python
    14·1 answer
  • A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To ac
    5·2 answers
  • Emails, Documents, Videos and Audios are examples of- (a) Structured data (b) Unstructured data (c) Semi-structured data (d) Non
    10·1 answer
  • Write a function template that accepts an argument and returns its absolute value. The absolute value of a number is its value w
    11·1 answer
  • Write a program that computes how much each person in a group needs to pay (after tax and tip) when splitting the bill equally.
    5·1 answer
  • A router periodically goes offline. Once it goes offline, you find that a simple reboot puts the router back online. After doing
    12·1 answer
  • How many times is the second for loop going to loop in this block of code? Write your answer in numeric form in the box provided
    6·1 answer
  • What is the earliest age you can collect social security.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!