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

ASAP.
13. How do distracters impact your study time? They cause you to lose focus and lose time. They make studying almost impossible. They cause you to lose focus and that results in lower grades. They make you drowsy and distracted.​

Answers

Answer:

A

Explanation:

You could pick any answer and make a case for it. It depends on what you have been told.

I would pick A but I wouldn't be surprised if the answer isn't the last one.

Why would a user select More Items for mail merge fields? to manually set an IF-THEN logic for the data field to manually change what merge field data is shown to manually select the format of the name in the greeting line to manually select and place additional fields at an insertion point

Answers

Answer:to manually select and place additional fields at an insertion point

Explanation:

Answer:

D. to manually select and place additional fields at an insertion point

Explanation:

edg. 2020

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.

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 that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a divisor (denominator). Your program should then divide the numerator by the denominator, and display the quotient followed by the remainder.Hint: If you use division (/) to calculate the quotient, you will need to use int() to remove the decimals. You can also use integer division (// ), which was introduced in Question 10 of Lesson Practice 2.3.Once you've calculated the quotient, you will need to use modular division (%) to calculate the remainder. Remember to clearly define the data types for all inputs in your code. You may need to use float( ) , int( ), and str( ) in your solution.float( ): Anything inputted by a user should be transformed into a float — after all, we are accepting ALL positive numbers, integers and those with decimals.int( ): When you divide the numerator and the divisor using /, make sure that the result is an integer.str( ): After using modular division, you can transform the quotient and remainder back into strings to display the result in the print() command.

Answers

Answer:

did you end up getting an answer

Explanation:

What is Napoleon's friend's full name? From the Napoleon Dynamite movie.

Answers

His friend's full name was Pedro Sanchez :)

Napoleons friends full name was Pedro Sanchez.

How is the Internet Simulator similar to the Internet?

Answers

Answer:

The internet simulator is similar to the internet because it connects multiple independent devices together to create a web of networks. the internet simulator is also not similar to the internet because the internet simulator is much slower than the actual internet because it transmits data bit by bit.

Explanation:

The Internet, as well as the Internet simulator, would be comparable in that they both connect many devices to establish communication. A further explanation is provided below.

Internet Simulator: It seems to be a technology meant to assist learners throughout obtaining practical learning or knowledge in addressing various difficulties associated with interconnected computing devices.Internet: A worldwide networking system that links computers all across the entire globe, is described as the internet.

Thus the above response is correct.

Learn more about the internet here:

https://brainly.com/question/17971707

which team member on a project typically enjoys solving difficult problems? ILL MARK BRAINEST​

Answers

Answer: the programmer.

Explanation: I did the test you used the picture on

Answer:

whats THE ANSWER IS HER WRONG

Explanation:

The text help readers understand the relationship between gender and sports?THESE PUMPKINS SURE CAN KICK!

Answers

Answer:

What's the question?????I don't understand

a researcher is discourage from putting too many words in the research title.why?

Answers

A title should be concise, specific, and direct to what it is all about. Normally, a research title is composed of 16 words at maximum. It should serve as the summary of the whole research study, hence, making it quite direct and brief. A research title is not a paragraph per se. It should be the quickest access to the whole research topic. It is definite on its own, only highlighting the very gist, and not too constructive to tackle the research.

1. Why Science and Technology is important in nation-building?

Answers

Answer: Technology, science and knowledge are important in modern contemporary society. ... Studies of technology and science provides students with insight into how different processes of knowledge are initiated and progressed, and how innovative technological processes are developed, employed and increase in importance.

Explanation: The role that science and technology has played in improving the life conditions across the globe is vivid, but the benefit has to been harvested maximum by all countries. Science and technology has made life a lot easier and also a lot better with the advancement of medicines and analysis on diseases.

Science and technology play a crucial role in nation-building for several reasons. Firstly, advancements in these fields drive economic growth by fostering innovation, leading to new industries and job opportunities.

Secondly, they improve the overall quality of life through better healthcare, communication, and infrastructure.

Additionally, scientific research and technological developments enhance a nation's global competitiveness and position it as a knowledge-based society.

Moreover, science and technology contribute to addressing societal challenges, such as environmental sustainability and resource management.

Know more about Science and technology:

https://brainly.com/question/1626729

#SPJ5

A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies. Below is an example file along with the program input and output: example.txt I AM SAM I AM SAM SAM I AM

Answers

Answer:

Here is the Python program:

filename=input('Enter the file name: ')  #prompts to enter file name

file = open(filename,"r+")  #opens file in read mode

dict={}  #creates a dictionary

for word in file.read().split(): #reads and splits the file and checks each word in the file

 if word not in dict:  #if word is not already present in dictionary

    dict[word] = 1  #sets dict[word] to 1

 else:  #if word is already in the dictionary

    dict[word] += 1  #adds 1 to the count of that word

file.close();  #closes file

for key in sorted(dict):  #words are sorted as per their ASCII value

 print("{0} {1} ".format(key, dict[key])); #prints the unique words (sorted order) and their frequencies

   

Explanation:

I will explain the program with an example:

Lets say the file contains the following contents:

I AM SAM I AM SAM SAM I AM

This file is read using read() method and is split into a list using split() method so the file contents become:

['I', 'AM', 'SAM', 'I', 'AM', 'SAM', 'SAM', 'I', 'AM']      

for word in file.read().split():  

The above for loop checks file contents after the contents are split into a list of words. So if statement if word not in dict: inside for loop checks if each item in the list i.e. each word is not already in dict. It first checks word 'I'. As the dictionary dict is empty so this word is not present in dict. So the statement dict[word] = 1 executes which adds the word 'I' to dict and sets it to 1. At each iteration, each word is checked if it is not present in dictionary and sets its count to 1. This way the words 'I', 'AM' and 'SAM' count is set to 1. Now when 'I' appears again then this if condition: if word not in dict: evaluates to false because 'I' is already present in the dict. So else part executes dict[word] += 1 which adds 1 to the count of this word. So frequency of 'I' becomes 2. Now each time when 'I' in encountered its count is incremented by 1. Since 'I' appears three times so frequency of 'I' is 3.

After all the words are checked and the loop ends, the next for loop for key in sorted(dict): uses sorted method to sort the items in dict in alphabetical order then check each key of the dict and prints the key value along with it frequency. So the output of the entire program is:

AM 3                                                                                                                           I 3                                                                                                                            SAM 3

The screenshot of program along with its output is attached.

Fill in the blank
What is the output of this program?
age = 4
if age > 5
print("more")
else
print("less")
Output:

Answers

age = 4

if age > 5:

print("more")

else:

print("less")

Answer: Less

Explanation: 4 is less than 5, so it will print less. I just tried it out on PyCharm.

You're a ticket agent for a commercial airline and responsible for checking the identification for each passenger before issuing their boarding pass. Due to federal regulations, there is a total of three different forms of ID that can potentially be used. You must determine whether the passenger has the sufficient identification to board the plane or not. Facts: ⢠A passport is enough for a boarding pass ⢠Without a passport, passengers must have two other forms of ID: driver's license birth certificate ⢠If the above two conditions are not met, then they are denied. Input Your solution must take in three boolean inputs. The first input represents whether they have a passport or not. The second input represents whether they have a driver's license or not. The third input represents whether they have a birth certificate or not Output The output should display as a boolean result whether they can board the plane or not. Sample Input Sample output true false false true false true true true false false false false

Answers

Answer:

Follows are the code to this question:

import java.util.*;//import package for user input  

public class Main //defining class  

{

  public static void main(String[] as)//main method

  {

      boolean x,y,z;//defining boolean variable

      Scanner ox= new Scanner(System.in);//create Scanner class object for user input

      System.out.println("input value: "); //print message  

      x=ox.nextBoolean();//input value

      y=ox.nextBoolean();//input value

      z=ox.nextBoolean();//input value

      System.out.println("Output: ");//print message

      System.out.println(x || (y &&z));//use print method to check value and print its value  

  }

}

Output:

1)

input value:  

true

false

false

Output:  

true

2)

input value:  

false

true

true

Output:  

true

3)

input value:  

false

false

false

Output:  

false

Explanation:

In the given code, inside the class three boolean variable "x,y, and z" is declared, that uses the scanner class for input the value from the user end, and in the next print, the method is declared, that uses " OR and AND" gate for calculating the input value and print its value.

In the AND gate, when both conditions are true. it will print the value true, and in the OR gate, when one of the conditions is true, it will print the value true.  

When collecting digital evidence from a crime scene, often the best strategy for dealing with a computer that is powered on is to:

Answers

Options:

a. remove the hard drive

b. transport it while running

c. perform a clean shutdown

d. unplug it

Answer:

d. unplug it

Explanation:

Indeed, unplugging the computer often the best strategy for dealing with a computer that is powered on so to preserve (or collect) digital evidence. By so doing it allows the investigator to safely check through the computer found at the crime scene.

However, if the investigator decides to remove the hard drive or performing a clean shutdown, valuable evidence may be lost as a result. Also, transporting it while running isn't going to be a viable option.

The birthday attacks are called so because we can only have 365 birthdays (oh well, excluding 2/29). So, if there are 366 people in a place at least two of them have the same birthday - thus causing collision(s). Same things happens in hash algorithm. The people in birthday attack is the same thing as

Answers

Answer:

The correct approach would be "the input in the hash algorithm".

Explanation:

The value that will also be determined because after value or importance is based seems to be hash. The birthday sometimes used measure the hash would have been the key. The algorithm would have a certain code as well as a pseudocode. Therefore the input upon whom hash would be evaluated is individuals.

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:

If the machine executes 5000 instructions every microsecond (millionth of a second), how many instructions does the machine execute during the time between the typing of two consecutive characters?

Answers

Answer:

5*10^9 instructions

Explanation:

Let's apply logic to solve this particular problem.

If 5000 instructions get executed in a millionth of a second, then this means that

5000 instructions gets executed every 1*10^-6 second

5000*10^6 instructions get executed every second, or say

5*10^9 instructions get executed after every second.

Going forward, it isn't stated how long it takes to type two consecutive characters, so will assume it's just 1 second(since it's consecutively).

So, succinctly put, if it takes 1 second to type the two characters consecutively, then the machine executed 5*10^9 instructions. And if it takes 2 seconds to type the two characters, then the machine would have executed 10*10^9 instructions

Lifelong learning ____?
A. stops when your career is over
B. only occurs in a classroom setting
C. begins after you retire
D. can be informal

Answers

B is the right answer

Answer:

can be informal

Explanation:

just took the Unit Test

Write the letter from D'Artagnan's father that was stolen from D'Artagnan in Meung. Include information about how D'Artagnan's father knows M. de Treville, describe D'Artagnan to M. de Treville, and request what D'Artagnan's father would like M. de Treville to do for D'Artagnan. Minimum 4 sentences.

Answers

Answer:

D'Artagnan's father advises him to be guided by his courage and his wits, ... town, but finds that the gentleman has stolen his letter of introduction to M. de Treville. ... D'Artagnan is received into M. de Treville's private chamber. However, before the two can speak, de Treville calls in two of his musketeers, Aramis and Porthos.

Explanation:

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

What do you use for soaking hands and holding soapy water​

Answers

Answer:

a bowl

Explanation:

a round, deep dish or basin used for food or liquid.

plz mark brainliest

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:

Give 2 bennifits of expert system

Answers

Answer:

Provide answers for decisions, processes and tasks that are repetitive.

Hold huge amounts of information.

Minimize employee training costs.

Centralize the decision making process.

Make things more efficient by reducing the time needed to solve problems.

here are a few

hope it helps : )

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

What order means that the highest numbers will be on top of the column

Answers

Answer:

Descending

Explanation:

What was the biggest problem with the earliest version of the internet in the late 1960’s?

Answers

Answer:

Explanation:

1.security issue

2. Computers were too big

3. Not very reliable

4. Networks couldn't talk to each other

5. Only be used in universities, governments, and businesses

Was able to solve it by myself. Thank you very much

Answers

Answer:

i hope you have a good day :) hehe

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

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.

Other Questions
Which of the following factors would have the least effect on the carrying capacity of an ecosystem?a.the total number of organismsb.the available water supplyc.the available food supplyd.competitive exclusion On Tuesday, a local hamburger shop sold a combined total of 402 hamburgers and cheeseburgers. The number of cheeseburgers sold was two times thenumber of hamburgers sold. How many hamburgers were sold on Tuesday?I hamburgers Bill rented a truck for one day. There was a base fee of $16.95, and there was an additional charge of 82 cents for each mile driven. Bill had to pay$222.77 when he returned the truck. For how many miles did he drive the truck? 4.56 10^3 into standard Form What plus 32 equals 98 1. What are you thoughts on the NY Times story about President Trump's taxes and finances?2. What are your thoughts on the Supreme Court nomination of Amy Coney Barret and the rush to confirmher before the election?Help me please! 3x -30 +4x = 7x + 24Please answer quickly!! will give brainliest! Alfred Wegener suggested that earths continents are moving. Which evidence supports this theory? Why did Spanish officials send an expedition led by Alonso de Leon to Texas in 1698? ey's Bell Jar...AbstractBackgroundPhotosynthesis maintains aerobic life on Earth, and Joseph Priestly firstdemonstrated this in his eighteenth-century bell jar experiments using mice andmint plants. In order to demonstrate the fragility of life on Earth, Priestley'sexperiment was recreated using a human subject placed within a modern-daybell jar.MethodsA single male subject was placed within a sealed, oxygen-depleted enclosure(12.4% oxygen), which contained 274 Cz and C plants for a total of 48 h. Acombination of natural and artificial light was used to ensure continuousphotosynthesis during the experiment. Atmospheric gas composition within theenclosure was recorded throughout the study, and physiological responses in thesubject were monitored.ResultsAfter 48 h, the oxygen concentration within the container had risen to 18.196, andhypoxaemia in the subject was alleviated (arterial oxygen saturation rose from86% at commencement of the experiment to 99% at its end). The concentrationof carbon dioxide rose to a maximum of 0.66% during the experiment.ConclusionsThis simple but unique experiment highlights the importance of plant life withinthe Earth's ecosystem by demonstrating our dependence upon it to restore andsustain an oxygen concentration that supports aerobic metabolism. Without thepresence of plants within the sealed enclosure, the concentration of oxygenwould have fallen, and carbon dioxide concentration would have risen to a pointat which human life could no longer be supported. A bowling ball is rolling down the lane at a constant velocity of 7.5 m/s. If the bowling ball travels 18 m down the entire lane, how long does it take for the ball to reach the end? Lucy is walking to the bathroom in the middle of the night. All of the lights are off and it is completely dark. She is almost too afraid to continue walking. A. Internal ConflictB. External Conflict Sohies mom cans jelly. She fills each jar with 1/2 a pint of jelly. If she made 1 7/10 pints of jelly, which expression can be used to find how many jars Sophies mom can fill? 72h-35h-12 please help me Acceleration is a vector quantity. When an object is said to have a negative acceleration, does it always mean that the object is slowing down? OTrue OFalse Refer to the article "Harun al-Rashid & One Thousand and One Nights."Which two details support the central idea that Harun al-Rashid was an extremely rich and learned ruler? during al-Rashid's rule, the Islamic world began to experience an explosion of cultural and intellectual growth. al-Rashid was the second son of his father, al-Mahdi, an important political leader. al-Rashid became the caliph -- or ruler -- of an Islamic state whose capital was the city of Baghdad." Libraries sprouted in cities across the caliphate, including the wonderfully named House of Wisdom in Baghdad, which al-Rashid helped found. i really need help! Find the slope of the line graphed below. Which statement best describes the general movement of air masses?A. They move from areas of high humidity to areas of low humidity.B. They move from areas of high altitude to areas of low altitude.C. They move from areas of low temperature to areas of high temperature.D. They move from areas of high pressure to areas of low pressure. What is NOT a way to write 52 + 80?A.50 + 2 + 80B.(50 + 80) + 2c.50 + 80 + 2 + 8D.50 + 2 + 80 + 0 What are the two inputs for aerobic cellular respiration?a. oxygen and glucoseb. carbon dioxide and atpc. carbon dioxide and waterd. glucose, atp and water