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
Natasha_Volkova [10]
3 years ago
5

Write a short program that allows the user to input a positive integer and then

Computers and Technology
1 answer:
pogonyaev3 years ago
5 0

Answer:

// code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int n;

   cout<<"Enter a positive number:";

   // read number

   cin>>n;

   // check number is positive or not

   while(n<0)

   {

   // if number is negative

       cout<<"Wrong input!!"<<endl;

       // ask again to enter again

       cout<<"Enter again:";

       // read number again

       cin>>n;

   }

   // generate random number between 1 to n

   int ran=rand()%n +1;

   // print random number

   cout<<"Random number between 1 to "<<n<<" is: "<<ran<<endl;

return 0;

}

Explanation:

Read a number from user.Then if input number is negative then ask user to enter a positive number again.After this generate a random number between 1 to n.Print that random number.

Output:

Enter a positive number:-12

Wrong input!!

Enter again:9

Random number between 1 to 9 is: 2

You might be interested in
Which of the following protocols is used by Web servers to establish communication between a web page and a web browser?
Iteru [2.4K]
HTTP or HTTPS is most likely the answer you are looking for.
6 0
3 years ago
How does the action affect the end result of what you want to accomplish?
suter [353]

Whichever action you take to complete a task will inevitably affect the end result of whatever would need to be accomplished; whether this impact the task in a positive or a negative way.

3 0
2 years ago
The protection of the confidentiality, integrity, and availability of information assets, whether in storage, processing, or tra
Sergeu [11.5K]

Answer: Information security

Explanation:

 The information security is one of the system that keeps the data confidential, assure the integrity and also availability of the information or data.

This system is basically refers as the CIA triad in the information security system and the data risk management.

The main aim of the information security is that keeps the data protected from the unauthorized accessing and also  controlling the access in the system.

Therefore, Information security is the correct answer.

8 0
3 years ago
?trophic levelNYIGVU.;/IO9YK7,'0;
grin007 [14]

please add more information, about your answer {history restored}

go to brainly.com for [HELP]

7 0
3 years ago
When it comes to having certain sales skills as a hotel manager, being able to really hear, learn about, and show customers that
Tju [1.3M]

Answer:

Communication

Explanation:

The ability to communicate clearly when working with customers is a key skill because miscommunications can result in disappointment and frustration. The best customer service professionals know how to keep their communications with customers simple and leave nothing to doubt.

7 0
2 years ago
Other questions:
  • Consider the latency model for static congestion windows. If the server receives an acknowledgement for the first data segment i
    5·1 answer
  • ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d12d13. The last digit d13 is a check
    9·1 answer
  • What does the machine do and how do the operators react to their work?
    13·1 answer
  • Windows Live SkyDrive is an example of _____ storage.
    13·1 answer
  • The italic button is located on the
    6·1 answer
  • What is essential to delivering a successful presentation?
    5·2 answers
  • 22
    15·1 answer
  • Need help asap<br> give the correct answer!!
    15·2 answers
  • A(n) _____ is created using the select and option elements that present users with a group of predefined possible values for the
    10·1 answer
  • An independent penetration testing company is invited to test a company's legacy banking application developed for Android phone
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!