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]
2 years ago
5

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

Computers and Technology
1 answer:
pogonyaev2 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
Select the correct statement(s) regarding digital baseband modulation.
NeTakaya

Answer:

The answer is "Option d".

Explanation:

The electronic firmware synchronization was its method where even the series of bytes is amplified even before the transmission process into to the sound waves and, thus, and in conceptual "1s" and "0s" represented by large font, wavelengths, or switching frequency.

  • QAM utilizes both magnitudes of the transporter and adjustments in the phase shift.
  • Rational data is represented by \frac{\pi}{2} cartesian coordinates for both the carries waves of the same wavelengths and represents the result in total.
6 0
3 years ago
A user is experiencing slow performance with their computer. A technician suspects the computer has a virus and runs antivirus s
IceJOKER [234]

Answer:

The answer is "Option A"

Explanation:

Escalation is the process of manipulating a bug, design failure in software program to obtain elevated access to the resources, which are usually shielded from the user, and wrong choices can be described as follows:

  • In option B, It is wrong because It can't provide any type of problem-solving.
  • In option C, It is wrong because it is a searching module.
  • In option D, It is wrong because it is used to verify the system.
6 0
3 years ago
Assume that printStars is a function that takes one argument and returns no value. It prints a line of N stars (followed by a ne
trasher [3.6K]

Answer:

printStars(35);

Explanation:

public class Question {

   public static void main(String args[]) {

     printStars(35);

   }

   public static void printStars(int numberOfStars){

       for(int i = 1; i <= numberOfStars; i++){

           System.out.print("*");

       }

       System.out.print("\n");

   }

}

7 0
3 years ago
Which of the following are ways that
Viefleur [7K]

Answer:

A and b

Explanation:

3 0
2 years ago
Who is the person responsible for creating the original website content?
Romashka [77]

Answer: D) Content creator

Explanation:

  • Content creator are responsible for creating the original content of the website. They contribute writing the blog posts about various topics and promote the content with the help of digital and social media.
  • Content creator are basically responsible for writing blog post on the industry based topics, graphic design and video editing.

Content editor uses data and evaluation from the users for analysis. It basically includes design and development to enhanced the material on the website.

Static and dynamic information are related to computer terminologies.

Therefore, (D) option is correct.

8 0
2 years ago
Other questions:
  • Heatsinks used to protect cpus in computers from overheating, are shaped so that their surface area is very large. why is that?
    5·1 answer
  • What is the purpose of a scatter plot introduction to computer applications
    6·2 answers
  • What is master slide and tell about master slide
    6·1 answer
  • If johnny has 800 socks and john has 1000 more how much does john have
    9·1 answer
  • A group of developers for a startup company store their source code and binary files on a shared open-source repository platform
    14·1 answer
  • Explain any 10uses of computer that are specific to your field of study giving appropriate examples​
    13·1 answer
  • The ____ attribute can be used only with input boxes that store text. Group of answer choices type pattern required value
    9·1 answer
  • Universal containers set the organization-wide defaults for cases to private. When a case is escalated, case ownership changes t
    13·1 answer
  • _________ can be used to provide access control, confidentiality, data origin authentication, connectionless integrity, rejectio
    12·1 answer
  • Define artificial intelligence?​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!