
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
C
Must be written in C
![Problem #2 - Initialize an array and compute the average
Write a program which creates a one dimensional array of float type with 5 elements. Name the array "data[]". Initialize the array when it is created with these values: 2.5, 3.33, 4.2, 8.0, 5.1.
Compute the average of all the elements in the array using a for loop to sum the array. Print out all the elements of the array using two columns. The first column is the index and the
second column is the value of the element. After printing out the index and values, print out the average of all the elements of the array. Make the output look like this screen shot. Name
the file "array_average.c"
Index
Value
2.500000
3.330000
4.200000
12
3
4
Avg
8.000000
5.100000
4.626000
Process returned 0
Press any key to co](https://content.bartleby.com/qna-images/question/b488d958-b9f8-4820-a61d-1a1d881a5d5d/b4fc867f-c436-4f8c-81a2-c96ab89cba9f/8n5pnl5_thumbnail.png)
Transcribed Image Text:Problem #2 - Initialize an array and compute the average
Write a program which creates a one dimensional array of float type with 5 elements. Name the array "data[]". Initialize the array when it is created with these values: 2.5, 3.33, 4.2, 8.0, 5.1.
Compute the average of all the elements in the array using a for loop to sum the array. Print out all the elements of the array using two columns. The first column is the index and the
second column is the value of the element. After printing out the index and values, print out the average of all the elements of the array. Make the output look like this screen shot. Name
the file "array_average.c"
Index
Value
2.500000
3.330000
4.200000
12
3
4
Avg
8.000000
5.100000
4.626000
Process returned 0
Press any key to co
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- Following are some examples of distinct categories of programming languages: Briefly describe how each one works.arrow_forwardDescribe the advantages of unit testing while using C#arrow_forwardIf a programmer is already skilled in a number of programming languages, why is it necessary for them to be able to learn new ones?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY