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
AlekseyPX
3 years ago
10

Write a main method that prompts the user for an integer between 1 & 10 (inclusive). If the user enters an invalid number, p

rompt for another one. When a valid number is entered, call activity with that number as a parameter.
Computers and Technology
1 answer:
stepan [7]3 years ago
5 0

Answer:

int main() {

   int n;

   cout<<"Enter the integer n"<<endl;

   cin>>n;

   if(n<1 || n>10)

   {

       while(n>10 || n<1)//taking input if the number is not within range..

       {

           cout<<"Enter the number again"<<endl;

           cin>>n;

       }

       activity(n);//calling activity with the n..

   }

return 0;

}

Explanation:

Above written is the main function in which a prompting an integer between 1 and 10 if it is not within range then again taking input.Then after that calling activity with n as argument.

You might be interested in
Why do we need to know the different Networking Devices?​
N76 [4]

Answer:

Router. Routers help transmit packets to their destinations by charting a path through the sea of interconnected networking devices using different network topologies. ... This is needed because LANs and WANs use different network protocols. Such routers are known as border routers.

3 0
3 years ago
9.3 Code Practice
julsineya [31]

Answer:

import random

def grid_maker(x, y):

   return [ [str(random.randint(-30, 30)) for _ in range(x)]for _ in range(y) ]

print ('\n'.join(' '.join(row) for row in grid_maker(4, 5)))

Explanation:

We use a template function and we generate numbers between -30 and 30:

>>> [str(random.randint(-30, 30))]

We also use the str() method so we can later concatenate the integers with \n. If you do not specify the integers, it will cause a crash. Also, keep in mind if we use a variable to store the integers, it will come out more of like a seed than a random grid. For instance, output without the random integers in a variable:

-12 16 -18 -3

7 5 7 10

18 -21 -16 29

21 3 -4 10

12 9 6 -9

Vs with a variable:

-25 6 -25 -20

-25 6 -25 -20

-25 6 -25 -20

-25 6 -25 -20

-25 6 -25 -20

Next we specify the  x and the y:

>>> for _ in range(x)]for _ in range(y) ]

Next we just print it and create a new line every time a row is made

hope this helped :D

5 0
3 years ago
Read 2 more answers
Which tab do you open to access the Comments feature?
avanturin [10]

Answer:

Review tab

Explanation:

On the ribbon, go to the Review tab and select New Comment

4 0
3 years ago
What information should the subtitles in the clips of your video per folio provide?
zheka24 [161]

Answer:

D

Explanation:

You can tell by the definition of subtitles. If you play a movie on your DVD player or something, you can see subtitle options at the menu and if you enable subtitle, it will display the text of conversation during the movie.

5 0
3 years ago
True or False. A modern programming EXE provides a text editor, a file manager, a compiler, a linker and loader, and tools for d
Flauer [41]

Answer:

True

Explanation:

Mordern programming environments provide essential tools needed to build, test, debug, etc. examples are VSCode, Atom, Sublime text, etc.

7 0
3 years ago
Other questions:
  • g Write a program that prompts the user to enter two integers. The program outputs how many numbers are multiples of 3 and how m
    11·1 answer
  • How can a user choose settings that will customize a presentation so that it is best to be played automatically at a kiosk rathe
    11·2 answers
  • In a typical system design specification, the _____ section contains the complete design for a new system, including the user in
    5·1 answer
  • Richard Palm is the accounting clerk of Olive Limited. He uses the source documents such as purchase orders, sales invoices and
    12·1 answer
  • A section in a history book describing the conditions and causes of the Great Depression in the Midwest in the 1930s. a. Enterta
    15·1 answer
  • How to change your name to a fake one
    8·1 answer
  • In this class, it is very common for your computer screen to look like this. What is this?​
    5·1 answer
  • java Two smallest numbers Write a program that reads a list of integers, and outputs the two smallest integers in the list, in a
    6·1 answer
  • What is meant by astigmation​
    9·2 answers
  • When you get a new sim card do it come with a new number or do you have a activate the phone and get a new number in store ?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!