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
goldenfox [79]
2 years ago
13

What is the problem, if any, with the following code?The desired output is [3,19].

Computers and Technology
1 answer:
vfiekz [6]2 years ago
8 0

Answer: You need a temporary variable to hold the value 3

Explanation:

So, aList[0] is 3 and aList[1] is 19, if it will be as it is you litteraly say to the compiler to change aList[0] to aList[1]  at this moment aList[0] is 19 and aList[1] also is 19 and if you try to change aList[1] to aList[0]  it will not change its value because they are the same.

You need temp variable to keep one of the values.

You might be interested in
How can you make the LED pattern continue to blink a certain number of times or indefinitely?
Maurinko [17]

Answer:

press flash

Explanation:

its on the bottom row on the remote on mine

8 0
3 years ago
Read 2 more answers
HEEEEELPPP!!!BRAINLIEST!!! THIS IS URGENT!!!
Fittoniya [83]

Answer:

Begin the statement with the proper keyword to start the loop

Explanation:

Given

The code segment

Required

Fix the code

The first line of the code segment is meant to be a for loop, but it does follow the right syntax.

This is so because the for keyword is missing.

The first line should be corrected and replaced with:

for count in range(80):

Hence, option (b) is correct

4 0
2 years ago
WILL GIVE BRAINLEST!!!!!!
Nataliya [291]

Answer:

a. divide the viewfinder into three equal, vertical divisions

Explanation:.

4 0
2 years ago
Read 2 more answers
Write a program that first gets a list of integers from input. Then, get another value from the input, and output all integers l
jonny [76]

Answer:

The c++ program for the given scenario is given below.

#include <iostream>

using namespace std;

int main() {

   int len=20, arr[len], data;    

   // initialize all elements of the array to 0

   for(int i=0; i<len; i++)

   {

       arr[i] = 0;

   }    

   cout<<"This program outputs all the numbers less than or equal to the given number."<<endl;

   cout<<"Enter the list of numbers. Enter 0 to stop entering the numbers. "<<endl;

   for(int i=0; i<len; i++)

   {

       cin>>arr[i];        

       // 0 indicates user wishes to stop entering values  

       if(arr[i] == 0)

           break;

       else

           continue;

   }    

   // number from which the list is to be compared

   cout<<"Enter the number to be compared."<<endl;

   cin>>data;

     

   cout<<"The values less than or equal to the number "<<data<<" are "<<endl;

   for(int i=0; i<len; i++)

   {  

       // 0 indicates the end of the list entered by the user

       if(arr[i]==0)

           break;

       if(arr[i] <= data)

           cout<<arr[i]<<endl;

   }    

   return 0;    

}  

OUTPUT

This program outputs all the numbers less than or equal to the given number.

Enter the list of numbers. Enter 0 to stop entering the numbers.  

23

45

67

89

10

0

Enter the number to be compared.

59

The values less than or equal to the number 59 are  

23

45

10

Explanation:

This program takes input only from the user and makes no assumptions.

The list of numbers entered by the user are stored in an array. If the user input is less than the size of the array, the remaining elements are set to 0.

While taking input from the user, if any element of the array is found to be 0, the loop is discontinued.

for(int i=0; i<len; i++)

   {

       cin>>arr[i];        

       if(arr[i] == 0)

           break;

       else

           continue;

   }  

Same test is applied when all the numbers less than the given number are displayed.

for(int i=0; i<len; i++)

   {  

        if(arr[i]==0)

           break;

       if(arr[i] <= data)

           cout<<arr[i]<<endl;

   }

The above program takes into account all the specifications in the given question.

5 0
3 years ago
Write a Python function to determine the volume of material remaining after the hole is drilled. The function should take as inp
Andru [333]

Answer:

height = int(input ("Enter height : ") )

print (height)

width = int( input("Enter length : ") )

print (width)

half_width =width/2

half_height=height/2

while 0==0:

   radius = float( input("Enter radius : ") )

   print (radius)

   

   if radius<half_width and radius <half_height:

       break

def remainingVolume(height,width,radius):

       

   vol_box=height*width*width

   print (vol_box)

   vol_hole=3.14178*radius*radius*height

   print (vol_hole)

   

   remaining_vol=vol_box-vol_hole

   print ("Remaining volume is ",remaining_vol)

   

remainingVolume(height,width,radius);

Explanation:

Take input from user for height ,width and radius. To find volume of box formula is vol=height* width*length\\

Let's assume width and length is same so

length= width

Using this formula of box volume find box volume.Now find volume of hole.

Consider hole as small cylinder, find volume of cylinder and subtract from volume of box to get remaining volume of box after hole.

vol_of_cyl=\pi radius^{2} height

5 0
2 years ago
Other questions:
  • To check whether your writing is clear , you can
    15·2 answers
  • what is it called when someone uses software to run multiple operating systems on one computer at the same time? A.functional vi
    9·1 answer
  • Which of these sites would need additional investigation to check for reliability?
    8·2 answers
  • Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is
    14·1 answer
  • Which layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two
    12·1 answer
  • What are the 3 biggest advancements in computers?
    14·1 answer
  • Differences between dot_mattix printer and a line printer
    12·1 answer
  • What is a web browser​
    9·1 answer
  • write a program which prompts the user for a celsius temperature, convert the temperature to fahrenheit, and print out the conve
    6·1 answer
  • What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!