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
Over [174]
3 years ago
5

Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to

print two random integers between (and including) 0 and 9. End with a newline. Ex: 5 7 Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again. (Notes)

Engineering
1 answer:
liq [111]3 years ago
4 0

Answer:

View Image

Explanation:

No number is really ever random. It all has a seed, which is an initial value for the 'random' number to be generated. The rand() function uses an equation to  generate its value, and all its 'random' value depend on the first number you plug in into your equation. The initial number you plug into your equation is what srand() do.

If you just call rand() alone without calling srand() then the generated numbers will automatically use srand(1) as a default seed. Using the same srand() value will always yield the same sequence of numbers.

To get a number between 0 and 9, take the modulus of it with 10 because modulus give you the remainder, so the number rand()%10 will never be equal to 10 or greater.

You might be interested in
5. Assume that you and your best friend ench have $1000 to invest. You invest your money
Bezzdna [24]

Correct question reads;

Assume that you and your best friend each have $1000 to invest. You invest your money in a fund that pays 10% per year compound interest. Your friend invests her money at a bank that pays 10% per year simple interest. At the end of 1 year, the difference in the total amount for each of you is:

(a) You have $10 more than she does

(b) You have $100 more than she does

(c) You both have the same amount of money

(d) She has $10 more than you do

<u>Answer:</u>

<u>(d) She has $10 more than you do</u>

<u>Explanation</u>:

Using the compound interest formula

A= P [ (1-i)^n-1

Where P = Principal/invested amount, i = annual interest rate in percentage, and n = number of compounding periods.

<u>My compound interest is:</u>

= 1000 [ (1-0.1)^1-1

= $1000

$1,000 + $1,000 invested= $2,000 total amount received.

<u>My friend's simple interest is;</u>

To determine the total amount accrued we use the formula:

P(1 + rt) Where:

P = Invested Amount (1000)

I = Interest Amount (10,000)

r = Rate of Interest per year (10% or 0.2)

t = Time Period (1 )

= 1000 (1 + rt)

= 1000 (1 + 0.1x1)

= $1100 + $1000 invested = $2100 total amount received.

Therefore, we observe that she (my friend) has $100 more than I do.

5 0
3 years ago
Find the differential and evaluate for the given x and dx: y=sin2xx,x=π,dx=0.25
Sedaia [141]

By applying the concepts of differential and derivative, the differential for y = (1/x) · sin 2x and evaluated at x = π and dx = 0.25 is equal to 1/2π.

<h3>How to determine the differential of a one-variable function</h3>

Differentials represent the <em>instantaneous</em> change of a variable. As the given function has only one variable, the differential can be found by using <em>ordinary</em> derivatives. It follows:

dy = y'(x) · dx     (1)

If we know that y = (1/x) · sin 2x, x = π and dx = 0.25, then the differential to be evaluated is:

y' = -\frac{1}{x^{2}}\cdot \sin 2x + \frac{2}{x}\cdot \cos 2x

y' = \frac{2\cdot x \cdot \cos 2x - \sin 2x}{x^{2}}

dy = \left(\frac{2\cdot x \cdot \cos 2x - \sin 2x}{x^{2}} \right)\cdot dx

dy = \left(\frac{2\pi \cdot \cos 2\pi -\sin 2\pi}{\pi^{2}} \right)\cdot (0.25)

dy = \frac{1}{2\pi}

By applying the concepts of differential and derivative, the differential for y = (1/x) · sin 2x and evaluated at x = π and dx = 0.25 is equal to 1/2π.

To learn more on differentials: brainly.com/question/24062595

#SPJ1

4 0
2 years ago
What parts of a ship have plastic? And what type of plastic?
goblinko [34]

Answer:

I know ship has stream line body

3 0
3 years ago
tech A says that a Hall-effect sensor can be used in an electronic ignition system. Tech B says that an optical-type sensor can
Alex

Answer:

<em>Both Tech A and Tech B are correct.</em>

<em>Explanation:</em>

<em>The Hall effect sen sensor are used to control displacements and rotations of various body components  of the vehicles, engine vibrations , and the ignition   system</em>

<em>The  optical-type sensor converts rays of light  into electronic signals. It measures the quantity physically of which the translates to a form that is understandable or readable  by an instrument. An optical sensor is larger part of a  system that integrates light sources, a device for measuring  and the optical sensor, which therefore is usually  connected to an electrical trigger.</em>

6 0
3 years ago
1. A thin plate of a ceramic material with E = 225 GPa is loaded in tension, developing a stress of 450 MPa. Is the specimen lik
mina [271]

Answer:

fracture will occur as the value is less than E/10 (= 22.5)

Explanation:

If the maximum strength at tip Is greater than theoretical fracture strength value then fracture will occur and if the maximum strength is lower than theoretical fracture strength then no fracture will occur.

\sigma_m = 2\sigma_o [\frac{a}{\rho_t}]^{1/2}

=  2\times 750 (\frac{\frac{0.2mm}{2}}{0.001 mm}})^{1/2}

                 = 15 GPa

fracture will occur as the value is less than E/10 = 22.5

7 0
3 years ago
Other questions:
  • A curve with 0.3 m constant radius contains a bead that is moving on it such that its rotational velocity is 3t2 sec-1. If the b
    12·1 answer
  • A venturi meter is to be installed in a 63 mm bore section of a piping system to measure the flow rate of water in it. From spac
    15·1 answer
  • Which of the following is an example of seeking accreditation?
    7·1 answer
  • In dynamics, the friction force acting on a moving object is always a) in the same direction of its motion b) a kinetic friction
    15·1 answer
  • Air at 27°C, 1 atm flows parallel to a flat plate, which is electronically heated. The plate is 0.5 m long in the direction of f
    8·1 answer
  • A two-phase mixture of water and steam with a quality of 0.63 and T = 300F expands isothermally until only saturated vapor rema
    7·1 answer
  • What is the function of engineering
    6·1 answer
  • I will mark brainliest.
    6·2 answers
  • What is the condition for maximum efficiency in a DC motor?
    15·1 answer
  • The following is a series of questions pertaining to the NSPE Code of Ethics. Please indicate whether the statement are true or
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!