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
Alinara [238K]
2 years ago
15

Write a program that asks the user to enter two integer numbers X and Y. The program halves each number between X and Y then pri

nts the values on the screen. For example: If X=5 and Y=7, the program prints the following values 5/2=2.5, 6/2=3.0 and 7/2=3.5 Sample run 1: Enter X and Y: 5 7 2.5 3 3.5 Sample run 2: Enter X and Y: 15 10 5.0 5.5 6.0 6.5 7.0 7.5

Computers and Technology
1 answer:
QveST [7]2 years ago
5 0

Answer:

`I wrote a quick script in Python, to get you started a little basic and doesn't cover much but it works

Explanation:

starting off x = input(...) and y = input(...) is simply grabbing the input from the users then I make a base array vals defined like:

vals = []

to store the calculated results

rx = int(x) and ry = int(y), are simply converting the x, y which are strings into a int type, so I can use them on this line:

for i in range(rx, (ry + 1)):

I added the + 1 to ry because the range ends at the number before Y, example:

for i in range(5, 8):

 print(i) -> 5,6,7

with all of that I simply ran an iteration <em>for loop</em> and calculated and store the results into vals presented here:

vals.append(i / 2)

If there's any confusion leave a comment I'll try my best to help out

You might be interested in
What is the proper citation for a video source? A. Video: Hank Aaron. Dir. Don Donto. VidCassette. 1985. DVD. Home Video, 1986.
VashaNatasha [74]
The answer it had to be B
6 0
2 years ago
The type of line shown below represents an / a:​
VikaD [51]

Answer:

esrfsrtg

Explanation:

6 0
3 years ago
__________ is the most refined and restrictive service model. a) IaaS b) CaaS c) PaaS
7nadin3 [17]

Answer:

c) PaaS

Explanation:

Refined and restrictive service model allows the user to use full package of application stack as demand by the service. It should be noted that "PaaS" is the most refined and restrictive service model.

Platform as a Service known as (PaaS ) is computing platform that gives room for the user in the cloud to manage applications.

PaaS helps to overcome the problem in managing the complexity of software licence. Example of PaaS are window Azure,Apache Stratos.

4 0
2 years ago
Write a code in C++ that can save 100 random numbers in an array that are between 500 and 1000. You have to find the average of
Anni [7]

Answer:

#include <iostream>

#include <random>

//here we are passing our array and a int by ref

//to our function called calculateAverage

//void is infront because we are not returning anything back

void calculateAverage(int (&ar)[100], int &average){

 int sum = 0;

 for(int i = 0;i < 100; i++){

   //adding sum

   sum += ar[i];

 }

 //std:: cout << "\naverage \t\t" << average;

//calculating average here

 average += sum/100;

}

int main() {

 int value = 0;

 int average = 0;//need this to calculate the average

 int ar[100];

 //assign random numbers from 500 to 1000

 //to our array thats called ar

 for(int i = 0; i < 100; i++){

   value = rand() % 500 + 500;

   ar[i] = value;

   

 }

 calculateAverage(ar,average);

 // std:: cout << "\naverage should be \t" << average;

 

}

Explanation:

not sure how else this would work without having to pass another variable into the function but I hope this helps!

I commented out the couts because you cant use them according to ur prof but I encourage you to cout to make sure it does indeed calculate the average!

3 0
3 years ago
A) Why should assembly language be avoided for general application development?
garri49 [273]

Answer:

(A) Assembly language should be avoided for general application development for the following reasons:

i. It is difficult to write assembly language codes. It does not contain many tools and in-built functions to help with the development of these applications.

ii. Since general application development requires that the application be machine independent, writing such applications in assembly language (which is a low level, machine dependent language) might be a pain as it would require that the writer have sufficient knowledge of hardware and operating systems.

(B) The following are the circumstances where assembly language should be used:

i. Assembly languages are low level languages that are very close to machine languages that the machine or processor understands. Therefore, when writing codes for programs that should directly communicate with the processor, assembly language should be used.

ii. Since assembly language codes are machine dependent, when there is a need to write applications for target machines, they should be used.

iii. If there is a need to have very great control of certain features of your application and resources to be consumed such as amount of RAM, clock speed e.t.c, assembly languages are a great tool.

(C) Some of the advantages of compiled language over an interpreted language are:

i. Compiled languages are way faster than interpreted languages because the compiled languages are converted directly into native machine codes that are easy for the processor to execute. Put in a better way, with compiled languages, codes are compiled altogether before execution and therefore reduces the overhead caused at run time. Interpreted languages on the other hand executes codes line after line thereby increasing the overhead at run time.

ii. Since codes are compiled first before execution in compiled languages, nice and powerful optimizations can be applied during the compilation stage.

(D) Interpreted languages could be chosen over compiled languages for the following reasons:

i. Interpreted languages are much more flexible and easier to implement than compiled languages as writing good compilers is not easy.

ii. Since interpreters don't need to convert first to intermediary codes as they execute these codes themselves, programs built with interpreters tend to be platform independent.

6 0
3 years ago
Other questions:
  • Oliva was a sophomore thriving in college when her father was laid off from his job. Even with financial aid, the family could n
    12·1 answer
  • Ideation includes all of the following EXCEPT
    5·1 answer
  • And what way do you mixed and market economy support the ideals of democracy​
    12·1 answer
  • You have spent $4,000 on liquor for your bar. Your bar sales have been $24,000. What is your cost of sales for liquor, expressed
    5·1 answer
  • The _________ unit, within the CPU, interprets software instructions and literally tells the other hardware devices what to do,
    5·1 answer
  • Which of the following is not hardware? wireless network router X-box 360 game controller virus scanner flat-panel monitor
    5·2 answers
  • Python;
    6·1 answer
  • in a stop-and-wait arq system, the bandwidth of the line is 1 mbps, and 1 bit takes 10 ms to make a round trip. if the system da
    12·1 answer
  • What are the four steps for planning a table?​
    10·1 answer
  • Question: 11
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!