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
Talja [164]
4 years ago
12

(50 points) Write a programthat adds the first and last elements of an integer array and stored as the first element of the outp

ut array, adds the second and second-to-last elements and stored as the second number, and so on. If the array hasan odd number of integers, leave the central integer inthe original arrayunchanged.
Computers and Technology
1 answer:
Elena L [17]4 years ago
3 0

Answer:

A is the input array

B = [] ; %B is initially an empty array

for i = 1:length(A)/2  %iterates over A until the midpoint of A

   B(i) = A(i) + A(end + 1 - i);  %This adds the numbers from the first half and %second half of A, and stores in B

end

disp(B)

You might be interested in
Before entering a road from an alley or driveway, you must:Flash your high beam headlights 
JulsSmile [24]

Stop before reaching the sidewalk. Hope this helps

3 0
3 years ago
The process of providing only the essentials and hiding the details is known as _____. Group of answer choices algorithm abstrac
almond37 [142]
The answer is data structure
8 0
2 years ago
2.
Sauron [17]
Im pretty sure it is b
7 0
3 years ago
In access, field names cannot contain digits. true or false.
Sedaia [141]
The answer is false.
8 0
3 years ago
Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job
viktelen [127]

firstly we have to create class and then constructors and method

let start with class

class Employee:

   def __init__(self, name, id, department, title):

       self.__name = name

       self.__id = id

       self.__department = department

       self.__title = title

   def set_name(self, name):

       self.__name = name

   def set_id(self, id):

       self.__id = id

   def set_department(self, department):

       self.__department = department

   def set_title(self, title):

       self.__title = title

   def get_name(self):

       return self.__name

   def get_id(self):

return self.__id

   def get_department(self):

       return self.__department

   def get_title(self):

       return self.__title

def __str__(self):

       return 'Name: ' + self.__name + \

              '\nID number: ' + self.__id + \

              '\nDepartment: ' + self.__department + \

              '\nTitle: ' + self.__title

Now to test the program

import emp

def main():

   emp1 = emp.Employee('name', 'id', 'department', 'title')

   emp2 = emp.Employee('name', 'id', 'department', 'title')

   emp3 = emp.Employee('name', 'id', 'department', 'title')

 

   emp1.set_name('Susan Meyers')

   emp1.set_id('47899')

   emp1.set_department('Accounting')

   emp1.set_title('Vice President')

   emp2.set_name('Mark Jones')

   emp2.set_id('39119')

   emp2.set_department('IT')

   emp2.set_title('Programmer')

   emp3.set_name('Joy Rogersr')

   emp3.set_id('81774')

   emp3.set_department('Manufacturing')

   emp3.set_title('Engineer')

   print()

   print(emp1)

   print()

 print(emp2)

   print()

   print(emp3)

main()

4 0
3 years ago
Other questions:
  • What piece of software tells the operating system how to use a specific hardware device?
    14·1 answer
  • E-mail is an temporary message medium.<br> a. True<br> b. False
    5·2 answers
  • Ou are driving in stop-and-go traffic during the daytime, and someone in another vehicle tells you that your brake lights are no
    10·1 answer
  • Is something wrong with Brainly?
    5·2 answers
  • If someone runs a red light in front of you and you choose not to slow down or steer away you will
    8·1 answer
  • If you are interested in working for a specific company, what type of job site should you look at for opening?
    12·1 answer
  • Which element is represented by the electron configuration in example B? Example B: 1s22s22p63s23p64s1 Aluminum Cesium Potassium
    12·2 answers
  • Define stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name()" followed
    8·1 answer
  • This is a standard routine used to perform a mathematical task in excel is called?
    9·1 answer
  • Imagery functions as a coding system to help individuals acquire movement patterns. this describes
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!