Write a program containing a loop that you execute 16 times. In the loop, generate two random numbers between 1 and 50. Divide the first random number by the second random number and print the result using 4 decimal places of accuracy.Lab Exercise #1 Put your name, the compiler used, and Lab Exercise #1 in a comment at the top of your program. Email your source code. This lab exercise is due at the beginning of the next lecture. You may email your lab solution prior to that. Remember to use "Ex1" as the subject of your email submission. Write a program containing a loop that you execute 16 times. In the loop, generate two random numbers between 1 and 50. Divide the first random number by the second random number and print the result using 4 decimal places of accuracy. Your output should look like this - except for different random values: 2.3333 35.0000 0.8000 3.2222 0.8667 0.1304 1.1429 0.2857 1.0698 0.7568 8.4000 0.7500 1.3030 1.2941 0.4130 1.7778 Hint: you should get a floating-point answer (a cast is suggested).

Answers

Answer 1

Answer:

Follows are the code to this question:

#include <stdio.h>// header file

int main()//main method

{

int i,x, y;//declaring integer variable

float result;//declaring flat variable

for(i=0; i<16; i++) //defining foe loop for calculate value  

{

x = (rand() % (50 - 0 + 1)) + 1;//use x variable for hold random value

y = (rand() % (50 - 0 + 1)) + 1;//use x variable for hold random value

result=(float)x/y;//use result variable for calculate value

printf("%.4f\n",result);//print value

}

return 0;

}

Output:

0.2200

0.2857

0.8684

0.7755

2.3000

0.1875

1.0500

1.3043

1.4839

1.2812

4.0000

0.9250

2.5000

1.8000

1.1034

1.1250

Explanation:

In the given code, three integer variable "i,x, and y" one float variable "result" is defined, in which integer variable "x and y" is used in the for loop, that uses the random function input value and in the float variable "result" it divides the value from x to y. This variable uses the typecasting to convert an integer to float and print its value.


Related Questions

Print the two-dimensional list mult_table by row and column. Hint: Use nested loops.

Sample output with input: '1 2 3,2 4 6,3 6 9':
1 | 2 | 3
2 | 4 | 6
3 | 6 | 9

Must be in Python

Answers

Answer:

m = int(input("Rows: "))

n = int(input("Columns:= "))

mult_table = []

for i in range(0,m):

    mult_table += [0]

for i in range (0,m):

    mult_table[i] = [0]*n

for i in range (0,m):

    for j in range (0,n):

         print ('Row:',i+1,'Column:',j+1,': ',end='')

         mult_table[i][j] = int(input())

for i in range(0,m):

    for j in range(0,n):

         if not j == n-1:

              print(str(mult_table[i][j])+" | ", end='')

       else:

              print(str(mult_table[i][j]), end='')

    print(" ")

Explanation:

The next two lines prompt for rows and columns

m = int(input("Rows: "))

n = int(input("Columns:= "))

This line declares an empty list

mult_table = []

The following two iterations initializes the list

for i in range(0,m):

    mult_table += [0]

for i in range (0,m):

    mult_table[i] = [0]*n

The next iteration prompts and gets user inputs for rows and columns

for i in range (0,m):

    for j in range (0,n):

         print ('Row:',i+1,'Column:',j+1,': ',end='')

         mult_table[i][j] = int(input())

The following iteration prints the list row by row

for i in range(0,m):

    for j in range(0,n):

         if not j == n-1:

              print(str(mult_table[i][j])+" | ", end='')

       else:

              print(str(mult_table[i][j]), end='')

    print(" ")

In this exercise we have to use the knowledge of computational language in python  to describe a code, like this:

The code can be found in the attached image.

To make it easier the code can be found below as:

m = int(input("Rows: "))

n = int(input("Columns:= "))

mult_table = []

for i in range(0,m):

   mult_table += [0]

for i in range (0,m):

   mult_table[i] = [0]*n

for i in range (0,m):

   for j in range (0,n):

        print ('Row:',i+1,'Column:',j+1,': ',end='')

        mult_table[i][j] = int(input())

for i in range(0,m):

   for j in range(0,n):

        if not j == n-1:

             print(str(mult_table[i][j])+" | ", end='')

      else:

             print(str(mult_table[i][j]), end='')

   print(" ")

See more about python at brainly.com/question/26104476

Write a program which has your own versions of the Python built-in functions min and max. In other words, write the functions called maximum(aList) and minimum(aList) that do the job of the built-in Python functions max(aList) and min(aList)respectively. They should take a list as an argument and return the minimum or maximum element . Test your functions with the list [7, 5, 2, 3, 1, 8, 9, 4]. Hint: Pick the first element as the minimum (maximum) and then loop through the elements to find a smaller (larger) element. Each time you find a smaller (larger) element, update your minimum (maximum).

Answers

Answer:

def maximum(aList):

   highest = aList[0]

   for number in aList:

       if number > highest:

           highest = number

       

   return highest

def minimum(aList):

   lowest = aList[0]

   for number in aList:

       if number < lowest:

           lowest = number

       

   return lowest

print(maximum([7, 5, 2, 3, 1, 8, 9, 4]))

print(minimum([7, 5, 2, 3, 1, 8, 9, 4]))

Explanation:

Create a function named maximum that takes one parameter, aList

Initialize the highest as the first number in aList

Create a for loop that iterates through the aList. Compare each number in aList with highest. If a number is greater than highest, set it as new highest.

When the loop is done, return the highest

Create another function named minimum that takes one parameter, aList

Initialize the lowest as the first number in aList

Create a for loop that iterates through the aList. Compare each number in aList with lowest. If a number is smaller than lowest, set it as new lowest.

When the loop is done, return the lowest

Call the functions with given list and print the results

which of the following best describes compounds.
A. They can only be separated chemically
b. they are always liquid at room temperature
c. they contain the atoms of just one element
d. they have the same properties as their elements

Answers

A. They can only be separate chemically

Answer:

A.

Explanation:

what is the output? there are no answer options and I'm completely lost.

>>>answer = "five times"

>>>answer[2:7] ​

Answers

The string answer = "five times"

All strings start at index 0 and end at the length of the string minus 1

So, if we count appropriately, index 2 is v and index 7 is m

answer[2:7] goes from v to m including v but not m, therefore,

answer[2:7] = "ve ti"

WILL MARK QUICKEST CORRECT ANSWER AS BRAINLIEST 11 PTS


Gary says, “Ports are where data enter a network before it reaches a gateway. The data travel via transmission media.”


Explain why Gary is right or wrong.



A) Gary is wrong. Ports are where connectors attach to destinations, not where data enter the network.


B) Gary is wrong. Gateways block data, so data don’t enter through them.


C) Gary is right.

Answers

Answer: Gary is wrong. Data do not travel via transmission media.

Answer:

the answer is Gary is wrong. Ports are where connectors attach to destinations, not where data enter the network.

Explanation:

correct on ed

Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing lines of asterisks. The first line will have one asterisk, the next two, and so on, with each line having one more asterisk than the previous line, up to the number entered by the user. On the next line write one fewer asterisk and continue by decreasing the number of asterisks by 1 for each successive line until only one asterisk is displayed. (Hint: Use nested for loops; the outside loop controls the number of lines to write, and the inside loop controls the number of asterisks to display on a line.) For example, if the user enters 3, the output would be:_______.a. *b. **c. ***d. **e. *

Answers

Answer:

Implemented using Python

n = int(input("Sides: "))

if(n>=1 and n <=50):

    for i in range(1,n+1):

         for j in range(1,i+1):

              print('*',end='')

         print("")

       

    for i in range(n,0,-1):

         for j in range(i,1,-1):

              print('*',end='')

         print("")

else:

         print("Range must be within 1 and 50")

Explanation:

This line prompts user for number of sides

n = int(input("Sides: "))

The line validates user input for 1 to 50

if(n>=1 and n <=50):

The following iteration uses nested loop to print * in ascending order

   for i in range(1,n+1):

         for j in range(1,i+1):

              print('*',end='')

         print("")

The following iteration uses nested loop to print * in descending order        

    for i in range(n,0,-1):

         for j in range(i,1,-1):

              print('*',end='')

         print("")

The following is executed if user input is outside 1 and 50

else:

         print("Range must be within 1 and 50")

Why do you think there is activity even when you are not actively using network services?

Answers

Answer:

Every social media platform has an algorithm, and just because you aren't using it, doesn't mean others are not engaged!

Explanation:

Jose wants to convert his birth year from digital to binary. Which Python function should Jose use?
O bin(year)
O bin = year
O binary(year)
O digi(year)

Answers

The correct python function is bin() therefore,

bin(year) is the correct answer.

THIS IS PYTHON QUESTION
d = math.sqrt(math.pow(player.xcor() - goal.xcor(), 2) + math.pow(player.ycor()-goal.ycor(), 2))

here is the error message that I am getting when I run this using the math module in python: TypeError: type object argument after * must be an iterable, not int

Answers

Answer:

ok

Explanation:yes

In a singing competition, there are 34 more men than women
Find the number of women participants if the total number of
participants is 128.

Answers

Answer:

94 women are there

Explanation:

it is easy subtraction you only have to 128-34

Answer:

You have to start with 128 and then you subtract 34. Subtract them together and you get 94 participants. Isn't it that simple?

After turning the volume all the way up on your speakers on your computer you still cannot hear any sound which of the following should be your next day? Should you replace your system speakers should you try to reinstall your sound card should you unplug your computer and plug it back in or should you check that your sound isn't muted?

Answers

Answer:

Shut your computer, and open it again. And if that doesn't work do it again

Explanation: The computer has done this before

You are going to send a document to a client, and you want to be absolutely sure that none of the formatting is lost. Which of these document formats would be best?


A Permissions

B Orientation

C Margins

D Location

Answers

Answer:

Explanation:

A because they would not ruin your work and they have to ask your permission if they want to edit it.

Answer: A
Explanation:

Xcode, Swift, and Appy Pie are all tools for doing what?

writing code in C#

creating smartphone apps

creating apps to run on a desktop or laptop

writing code in Java

Answers

Answer:

creating smartphone apps

Explanation:

Xcode, Swift, and Appy Pie are all tools for creating iOS applications.

These tools are used for app development in the iOS platform which is a rival to the Android platform.

They are used to build the apps from scratch, develop and test them,

Answer:

smart phone apps

Explanation:

I have to drag it to the correct definition plz help!

Answers

Answer:

Copyright - 1

Derivative works - 4

Intellectual property - 3

Fair use - 2

Explanation:

What is the World Wide Web?

A.
an information system where each document is linked to all other documents
B.
a large worldwide network of interconnected computers
C.
the collection of all online content you can access from your computer
D.
a worldwide social media network

Answers

Answer:

A an information system where each document is linked to all other documents

A. Am I formation system where each document is links Sri all other documents

Work made for hire. If an employer asks an independent designer to create an illustration, the copyright to that artwork is owned by the employer. true or false?

Answers

Answer:

False

Explanation:

On the basis of the designer being "independent", the artworks copyright remains with the designer. Being independent requires contractual transfer of copyright in the event that its created for another person.

The answer would be false trust me I just did this and got it correct.

What do you mean by this statement,
“Life is not a grand harmony, Conflict exist. We must learn how to live with it, use it constructive and minimize it’s destructive aspect”.

Answers

Answer with Explanation:

The statement above means that life is not always about happy moments; rather, it also includes unhappy times which teaches us many lessons. People should be aware of this, so that they'd also look at the good side of unhappy/sad moments in life. For example, when a beloved person dies, it is natural for one to cry. However, it is also important to stand up after that experience and become even stronger. This is a constructive way of moving on with life. A destructive aspect would be, not being able to move on and being stuck on one's death without thinking about the future anymore.

The best explanation of the given statement is:

If there is mutual understanding, then this would help in the conflict resolution to minimize the destructive impact.

What is Mutual Understanding?

This refers to the ability of a person or multiple persons to be able to have different points of view but also to understand that one view is NOT absolute.

With this in mind, we can note that because life is not a grand harmony, there will always be conflict, but if there is mutual understanding, then this would help in the conflict resolution to minimize the destructive impact.

Read more about conflict resolution here:

https://brainly.com/question/2267795

Explain the following terms as used in word processin
(a)
Drop cap
(b) A superscript
An indent​

Answers

Answer:

A drop cap (dropped capital) is a large capital letter used as a decorative element at the beginning of a paragraph or section. The size of a drop cap is usually two or more lines.

a superscript is a character(s) half the height of a standard character and printed higher than the rest of the text.

In word processing, the word indent is used to describe the distance, or number of blank spaces used to separate a paragraph from the left or right margins.

Mrs Jones had p hens then she decided to buy p more hens. how many hens does she have in all?​

Answers

Answer:

2p

Explanation:

if she had p, then she got p again, she got two p amounts. p+p = p*2 = 2p

how to write email abut new home your friend ​

Answers

Answer:

Start off with a greeting like Dear Sarah. Then you write a friendly body that tells about your home and describe it as much as you can and tell about what your bedroom theme is like and so on. Finally, top it off like a closing like Sincerely, Tessa.

Answer:

you start off by saying

Dear (name), talk about how your house is comforting and things like that... I hope thats what you were asking for.

The European Union requires companies to:

a
erase user data when requested.
b
keep all data open source.
c
never sell data.
d
delete all personal customer data after two years.

Answers

Answer:

C is the correct

Explanation:

1. Discuss data processing concepts and the representation of data in the computer


2. Explain how they work together to process data

Answers

Answer:

gkvjbdsvjnmfbhui jgbfdshjcxvabgsuciusgBFIULWGSfuRyt vqwyrgfgweVGYGTV7BWUIEGDWYUGDCYg

Explanation:

1) An employer has decided to award a weekly pay raise to all employees by taking the square root of the difference between his weight and the employee’s weight. For instance, an employee who weighs 16 pounds less than the employer will get a $4 per week raise. The raise should be in whole dollars (an int). Write a class file that prompts the user for the employee and the employer weight. Please output the correct raise amount making sure that all inputs are included in the output statement.

Answers

Answer:

Written in C++

#include <iostream>

#include<cmath>

using namespace std;

int main(){

   int weight1, weight2, diff;

   cout<<"Employees Weight: ";

   cin>>weight1;

   cout<<"Employers Weight: ";

   cin>>weight2;

   diff = abs(weight1 - weight2);

   float pay = round(sqrt(diff));

   cout<<pay;

   return 0;

}

Explanation:

I've added the source file as an attachment where I used comments as explanation

Part 1 Create a program that asks the user for a temperature in Fahrenheit, and then prints the temperature in Celsius. Search the Internet for the correct calculation. Look at Chapter 1 for the miles-per-gallon example to get an idea of what should be done.

Part 2 Create a new program that will ask the user for the information needed to find the area of a trapezoid, and then print the area.

Part 3 Create your own original problem and have the user plug in the variables.

IN PYTHON

Answers

Answer:

Written in Python

import math

#1. Temperature Conversion

degreeF = float(input("Degree Fahrenheit: "))

degreeC = (degreeF - 32) * 5/9

print("Degree Celsius: "+str(round(degreeC,2)))

#2. Area of Trapezoid

Base1 = float(input("Base 1: "))

Base2 = float(input("Base 2: "))

Height = float(input("Height: "))

Area = 0.5 * (Base1 + Base2) * Height

print("Area: "+str(round(Area,2)))

#3. Addition of Two Numbers

Num1 = float(input("Number 1: "))

Num2 = float(input("Number 2: "))

print("Result: "+str(Num1 + Num2))

Explanation:

This line imports the math library

import math

Program 1 starts here

#1. Temperature Conversion

This line prompts users for input in degree Fahrenheit

degreeF = float(input("Degree Fahrenheit: "))

This line converts to degrees Celsius

degreeC = (degreeF - 32) * 5/9

This line prints the converted degree

print("Degree Celsius: "+str(round(degreeC,2)))

Program 2 starts here

#2. Area of Trapezoid

The next three lines prompts user for necessary inputs

Base1 = float(input("Base 1: "))

Base2 = float(input("Base 2: "))

Height = float(input("Height: "))

This line calculates the area

Area = 0.5 * (Base1 + Base2) * Height

This line prints the area

print("Area: "+str(round(Area,2)))

The third program begins here. I've decided to write a program that sums two numbers

#3. Addition of Two Numbers

The next two lines prompt user for inputs

Num1 = float(input("Number 1: "))

Num2 = float(input("Number 2: "))

This line calculates and prints the sum

print("Result: "+str(Num1 + Num2))

What are technology trends in science check all that apply

Answers

Answer:

3D Printing Molecules.

Adaptive Assurance of Autonomous Systems.

Neuromorphic Computing (new types of hardware) and Biomimetic AI.

Limits of Quantum Computing: Decoherence and use of Machine Learning.

Ethically Trustworthy AI & Anonymous Analytics.

Explanation:

An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours, plus any overtime pay.

Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage.

Write a program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay.

Below is an example of the program inputs and output:

Enter the wage: $15.50
Enter the regular hours: 40
Enter the overtime hours: 12

The total weekly pay is $899.0

Answers

wage = float(input("Enter the wage: $"))

regular_hours = float(input("Enter the regular hours: "))

overtime_hours = float(input("Enter the overtime hours: "))

print(f"The total weekly pay is ${(regular_hours * wage) + ((wage*1.5) *overtime_hours)}")

I hope this helps!

3.
State and explain any Three elements of control unit​

Answers

Answer:

There are two types of control units: Hardwired control unit and Microprogrammable control unit.

Explanation:

The components of this unit are instruction registers, control signals within the CPU, control signals to/from the bus, control bus, input flags, and clock signals.

Answer:

The control unit (CU) is a component of a computer's central processing unit (CPU) that directs the operation of the processor. It tells the computer's memory, arithmetic and logic unit and input and output devices how to respond to the instructions that have been sent to the processor.

The three elements of a control unit are :

Memory or Storage Unit.a control unit.ALU(Arithmetic Logic Unit)

Explanation:

Mark brainliest.

Use the drop-down menus to complete the statements explaining the creation and management of an outline in Word 2016. The Outline view allows a user to add, expand, and collapse content in the document. Headers can be promoted or demoted in the outline by using the directional arrows or . Level 1 headings will appear in the pane.

Answers

Answer:

Heading and subheading

shortcut keys

navigation

Explanation:

i got it wrong and it showed

Answer:

Use the drop-down menus to complete the statements explaining the creation and management of an outline in Word 2016.

The Outline view allows a user to add, expand, and collapse

✔ heading and subheading

content in the document.

Headers can be promoted or demoted in the outline by using the directional arrows or

✔ shortcut keys

.

Level 1 headings will appear in the

✔ Navigation

pane.

Explanation:

When viewing the Mail Merge Recipients dialog box, what kinds of actions can you perform? Check all that apply. find recipient filter recipients print recipients sort column headings select/deselect recipients

Answers

Answer:

a,b,d,e on edg 2020

Explanation:

Answer:

Everything is correct except option 3/letter C.

Explanation:

A, B, D, and E

What is Chris Records LifePreneur Online Educational Training Program?

Answers

Answer:

LifePreneur stands for Lifesyle Entrepreneur. When you take the word lifestyle and entrepreneur to combine them together, you get the brand, LifePreneur. This is the concept behind Chris Record's LifePreneur company.

Lifepreneur is the long-awaited legacy project founded by online serial-entrepreneur Chris Record. Chris currently lives in scorching hot Las Vegas which is fitting because everything online he gets involved in goes big league. Chris has helped tens of thousands of people to start their own online business, and has a true passion for helping everyone succeed.

Lifepreneur is a membership program that you can join to get training in various aspects of online marketing, training and advice and investing, live in-person mentorship from Chris Record himself, and more. It is a membership program that you can sign up for free and it's designed to help you grow into more than just a business entrepreneur… A Lifepreneur.

More info : reddit's /r/LifePreneur

Other Questions
Is numbers 9 and 10 correct ??!! For number 9 I put : -2 For number 10 I put : 5/4, 4/5 , .75, 1.4, -5.8 I need help with 1-19!! Please help me!!! Read each question carefully. Choose the best answer for each question or statement.1. Which of the following sentences is correct? (2 points)Ich habe keinen Bleistift.Ich habe Bleistift nicht.Ich habe nicht einen Bleistift.Ich nicht haben Bleistift.2. Which of the following sentences is correct? (2 points)Wir haben Katzen nicht.Wir haben nicht Katzen.Wir haben keine Katzen.Wir haben Katzen keine.3. Which of the following sentences is correct? (2 points)Du schwimmst gerne nicht.Du schwimmst nicht gerne.Du schwimmst kein gerne.Du schwimmst keine gerne.4. Which is the correct translation for: Peter does not have pets? (2 points)Peter hat nicht Haustiere.Peter hat Haustiere keine.Peter hat Haustiere nicht.Peter hat keine Haustiere.5. Which negation word is missing in the sentence? Die Kinder essen _________ Gemse. (2 points)keinenichtkeinkeinen6. Fill in the missing demonstrative article. Ich mchte ______ Hund. (2 points)diesedieserdiesesdiesen7. Fill in the missing demonstrative article. Mir gefallen _____ Schmetterlinge. (2 points)dieserdiesediesesdiesen8. Fill in the missing demonstrative article. Ich kaufe ______ Pferd. (2 points)jenerjenejenesjenen9. Wie sagt man auf Deutsch: I like this frog.Ich mag ___________________ Frosch.(2 points)jenerdiesenjenendieser10. Wie sagt man auf Deutsch: I like those horses.Ich mag ________________ Pferde.(2 points)jenendiesediesenjene Who was included in the Republican Party of 1854? Select four responses.HELP FASTabolitionists Most Southern politicians people opposed to the spread of slaverypeople against the Kansas-Nebraska Act people worried about the Dred Scott decision slave owners What equation represents a line passing through the points (-2,1) and (1,7) in point slope form? The purpose of the Justinian Code was to establish artistic standards. 4. What was Nationalism in music during the nineteenth century? List at least four Nationalist composers and a piece they were known for composing. PLEASE HELP!!!!!!!!!!!!!!!!!! What was the Warsaw Pact? A. a military alliance to counter NATO B. an economic alliance to counter the EU C. a religious alliance between the USSR and Africa D. a political alliance joining the USSR and the United Statee State any six characteristics of present society Helpppppppppp please CORRECT ANSWER WILL GET BRAINLIEST!!!! what element can scratch a diomand? Factor the following expression using the GCF: 10ab + 20. what is the slope of a line with equation y-3=-1/2(x-2) Didn't the brain technically name it's self? how did Friday get its name The home that you want to purchase requires that you pay 3 points towards a $225,600 loan. Determine the cost of the home after the 3 points have been applied.a.$225,600c.$230,112 b.$227,856d.$232,368 How did social and economic inequalities that existed in France under the old regime create conditions for a revolution. ASAP PLZ A plumber charges a $45 fee to make a house call and then $25 for each hour of labor. The plumber uses an equation in the form y = m x + b to determine the amount to charge each customer.What is the value of m in the equation?