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
AfilCa [17]
3 years ago
8

A programmer wrote the code segment below to display the average of all the elements in a list called numbers. There is always a

t least one number in the list. text... The programmer wants to reduce the number of operations that are performed when the program is run. Which change will result in a correct program with a reduced number of operations performed?
Computers and Technology
1 answer:
mestny [16]3 years ago
3 0

Answer:

Swap codes in line 7 and 8

Explanation:

The code segment below

Line 1: count ← 0

Line 2: sum ← 0

Line 3: FOR EACH value IN numbers

Line 4: {

Line 5: count ← count + 1

Line 6: sum ← sum + value

Line 7: average ← sum / count

Line 8: }

Line 9: DISPLAY (average)

The above code will make the program translator calculate the average value at each iteration.

This will take a longer time to execute and also means more instructions for the program translator.

Swapping line 7 and 8 will reduce the number of instructions to execute. This will have an instant effect on the time taken to execute the program.

Swapping line 7 and 8 means that, the program translator will only calculate the average after it must have finished calculating the sum of the values in the iteration statement.

You might be interested in
Changing how information is represented so that it can be read by a person is called
Usimov [2.4K]

Answer:

Decode. To change how information is represented so that it can be read by a person.

Explanation:

Decoding is the ability to apply your knowledge of letter-sound relationships, including knowledge of letter patterns, to correctly pronounce written words. Understanding these relationships gives children the ability to recognize familiar words quickly and to figure out words they haven't seen before.

4 0
3 years ago
someone help me my browser is updated I don't know what to do someone help me please I'm trying to watch Crunchyroll.​
levacccp [35]

Answer: use chrome or firefox the browser app your using is one that they dont support

Explanation:

4 0
3 years ago
Read 2 more answers
Write a C++ program that reads students' names followed by their test scores. The program should output each students' name foll
Mashutka [201]

Answer:

#include<iostream>

#include<conio.h>

using namespace std;

struct studentdata{

char Fname[50];

char Lname[50];

int marks;

char grade;

};

main()

{

studentdata s[20];

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

   {

cout<<"\nenter the First name of student";

cin>>s[i].Fname;

cout<<"\nenter the Last name of student";

cin>>s[i].Lname;

cout<<"\nenter the marks of student";

cin>>s[i].marks;

}  

 

for (int j=0;j<20;j++)

{

if (s[j].marks>90)

{

 s[j].grade ='A';

}

else if (s[j].marks>75 && s[j].marks<90)

{

   s[j].grade ='B';

}

else if (s[j].marks>60 && s[j].marks<75)

{

 s[j].grade ='C';

}

else

{

 s[j].grade ='F';

}

}

int highest=0;

int z=0;

for (int k=0;k<20; k++)  

{

if (highest<s[k].marks)

{

 highest = s[k].marks;

 z=k;

}

 

}

cout<<"\nStudents having highest marks"<<endl;

 

cout<<"Student Name"<< s[z].Fname<<s[z].Lname<<endl;

cout<<"Marks"<<s[z].marks<<endl;

cout<<"Grade"<<s[z].grade;

getch();  

}

Explanation:

This program is used to enter the information of 20 students that includes, their first name, last name and marks obtained out of 100.

The program will compute the grades of the students that may be A,B, C, and F. If marks are greater than 90, grade is A, If marks are greater than 75 and less than 90, grade is B. For Mark from 60 to 75 the grade is C and below 60 grade is F.

The program will further found the highest marks and than display the First name, last name, marks and grade of student who have highest marks.

6 0
3 years ago
How can social media give you knowledge
cupoosta [38]
Social Media can you knowledge by most users on Social Media spreading their own knowledge.
5 0
3 years ago
Why is my brainly like this
Leto [7]
If your using a computer that's probably why lol it is cool though
8 0
3 years ago
Other questions:
  • What is the difference between computer architecture and computer organization?
    10·2 answers
  • Ben buys an Olympus E-PL2 from Sony which starts malfunctioning. When he opts for an exchange, the customer representative says
    11·1 answer
  • There are many modes of remote visual communication. Which is the most common mode?
    10·2 answers
  • The ____ tool allows a user to connect to the active registry database and make changes that are effective immediately. editreg.
    12·1 answer
  • The command to delete all the files that have filenames that starts with letter c or c and ends with a letter z or z is
    15·1 answer
  • Objects of the calculator class require no additional information when created. define an object named calc, of type calculator.
    14·2 answers
  • There are a few simple rules that you can follow to store and manage files and folders in your computer. What is the most import
    9·2 answers
  • A technician has a client’s laptop that is randomly shutting down. Which of the following is the FIRST step of the troubleshooti
    10·1 answer
  • Is there anybody who knows eris quirk but me- i feel lonely rn ;-;
    15·2 answers
  • Write an algorithm to get the value of length and breadth of a rectangle from the user and find its area. inn qbasic
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!