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
Romashka [77]
3 years ago
8

Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:

Computers and Technology
2 answers:
Dahasolnce [82]3 years ago
8 0

Answer:

#include

#include // Enables use of rand()

#include // Enables use of time()

int main(void) {

int seedVal = 0;

seedVal = 4;

srand(seedVal);

cout<< rand()%(int)(149-100+1) + 100;

cout<< rand()%(int)(149-100+1) + 100;

return 0;

}

Explanation:

The code segment starts at line 8 and ends at line 9.

That is:

cout<< rand()%(int)(149-100+1) + 100;

cout<< rand()%(int)(149-100+1) + 100;

The syntax for generating random values in C using rand function is

rand()%(int)(max - min + 1) + min

Or

min + rand()%(int)(max - min + 1).

It works both ways..

Where max and min represent the range of values needed (maximum and minimum)

The random statement can also be used in loops

rosijanka [135]3 years ago
6 0

Answer:

#include <stdlib.h>

#include <time.h>

#include<iostream.h>

int main(void) {

   int seedVal = 0;  

   seedVal = 4;

   srand(seedVal);

  /* Solution*/

  cout<<rand() % 149 + 100<<endl;

  cout<<rand() % 149 + 100<<endl;

  return 0;

}

Explanation:

We start with the required include statements to enable use of srand, rand and time functions. I have also added iostream library to use "cout" function.

After that, the seed is initialized using srand(). And then the two rand functions are called with ranges including and between 100 and 149, and printed out.

You might be interested in
Many ____ classes for certification are available on the Internet and by many companies that have set up intranets within their
Marina86 [1]

Many <u>online training</u> classes for certification are made available for students on the Internet and by many companies that have set up intranets within their organizations.

Certification can be defined as a recognition that is given to an individual (student) for the completion of a specific course of study and passing an examination. Thus, it usually issued to certify that an individual is a professional in a particular course of study.

Some examples of certifications that are issued to an individual (student) include the following:

  • CCNA
  • Comptia A+
  • HSE I and II

In this context, many companies with intranet facilities within their organizations offer <u>online training</u> classes for certification by making them available for students over the Internet.

Read more on certification here: brainly.com/question/1391803

5 0
2 years ago
Write IF() function for student 3, If total mark is greater than 10 then print
Debora [2.8K]

Answer:

Explanation:

The following code is written in Java. The if() function is actually called an if statement. The following code can be copied and pasted where you need as long as it is within the scope of the mark variable in order to call it and compare it to 10

if (mark > 10){

           System.out.println("you have scored good");  

       } else {

           System.out.println("you need to improve ");

       }

3 0
3 years ago
Which of the following best describes a proxy firewall? A. It sends traffic through another host. B. It acts as a gateway for re
12345 [234]
The answer would be B, for your computer is considered a client instead of server.
6 0
3 years ago
What does ""fair use"" mean regarding copyrighted works?
Nady [450]

In regards copyrighted works, fair use is simply known as legal dogma that allows the right to free expression by allowing the unlicensed use of copyright-protected works by individuals as regards to some certain situations.

Fair Use of copying of copyrighted material can only be used in a short and revelatory us, example to criticize, or caricature of a copyrighted work. It is often known to be a legal defense that protects individuals of copyrighted material from copyright infringement.

  • Fair use allows a person/people to use a copyrighted work without acknowledgement or permission of copyright owner and it can be used  to criticize, comment, news reporting, teaching, research etc. It is not seen as infringement under the law.

Conclusively, we can say that In regards copyrighted works, fair use is simply known as legal dogma that allows the right to free expression by allowing the unlicensed use of copyright-protected works by individuals as regards to some certain situations.

Learn more from:

brainly.com/question/1534807

5 0
2 years ago
Implement a function inValues() that asks the user to input a set of nonzero floating-point values. When the user enters a value
elena-s [515]

Answer:

Explanation:

The following is written in Python and uses exception handling to do exactly as requested. It then goes adding all of the integer values to an array called num_list and finally adding them all together when the function ends.

def in_values():

   num_list = []

   while True:

       try:

           num = input("Input non-zero floating point: ")

           num = int(num)

           if num == 0:

               break

           else:

               num_list.append(num)

       except ValueError:

           print("No valid integer! Please try again ...")

           try:

               num = input("Input non-zero floating point: ")

               num = int(num)

               break

           except ValueError:

               break

   sum = 0

   for number in num_list:

       sum += number

   return sum

5 0
3 years ago
Other questions:
  • The advent of optical discs was made possible by developments in ____ technology.
    5·1 answer
  • Andy is trying to put together a holiday gift knapsack (with W=8) for Sarah. He has n items to choose from, each with infinitely
    15·1 answer
  • Many businesses use robotic solutions. Which department of the food and beverage industry uses robotic solutions on a large scal
    10·2 answers
  • With a DUI charge on a driver’s record ______________.
    10·1 answer
  • What is it called to persist in trying to multitask can result in this; the scattering bits of one’s attention among a number of
    9·1 answer
  • Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will take 5 iterations in total, and in every ite
    6·1 answer
  • 1.printer is an example of......... device.<br><br>​
    11·2 answers
  • Which programming paradigm does the programming language JavaScript follow?
    14·1 answer
  • Write a program that repeatedly reads in integers until a negative integer is read. The program keeps track of the largest integ
    9·1 answer
  • Is it possible build a real time machine?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!