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
svlad2 [7]
2 years ago
9

write a 2d array c program that can capture marks of 15 students and display the maximum mark, the sum and average​

Computers and Technology
1 answer:
bekas [8.4K]2 years ago
3 0

Answer:

#include <stdio.h>  

int MaxMark(int* arr, int size) {

   int maxMark = 0;

   if (size > 0) {

       maxMark = arr[0];

   }

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

       if (arr[i] > maxMark) {

           maxMark = arr[i];

       }

   }

   return maxMark;

}

int SumMarks(int* arr, int size) {

   int sum = 0;

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

       sum += arr[i];

   }

   return sum;

}

float AvgMark(int* arr, int size) {

   int sum = SumMarks(arr, size);

   return (float)sum / size;

}

int main()

{

   int student0[] = { 7, 5, 6, 9 };

   int student1[] = { 3, 7, 7 };

   int student2[] = { 2, 8, 6, 1, 6 };

   int* marks[] = { student0, student1, student2 };

   int nrMarks[] = { 4, 3, 5 };

   int nrStudents = sizeof(marks) / sizeof(marks[0]);

   for (int student = 0; student < nrStudents; student++) {              

       printf("Student %d: max=%d, sum=%d, avg=%.1f\n",  

           student,

           MaxMark(marks[student], nrMarks[student]),

           SumMarks(marks[student], nrMarks[student]),

           AvgMark(marks[student], nrMarks[student]));

   }

   return 0;

}

Explanation:

Here is an example using a jagged array. Extend it to 15 students yourself. One weak spot is counting the number of marks, you have to keep it in sync with the array size. This is always a problem in C and would better be solved with a more dynamic data structure.

If you need the marks to be float, you can change the types.

You might be interested in
Trina Hauger works for Johnson Electric as a corporate lawyer, and part of her duties are to ensure the ethical and legal use of
Roman55 [17]

Answer:

b) chief privacy officer (CPO)

Explanation:

The CPO is responsible for ensuring the ethical and legal use of information within a company.

Chief knowledge officer (CKO) is a the person responsible for overseeing knowledge management within an organisation. This role is just like the role of chief learning officer.

A chief information officer (CIO) is the person responsible for the management, implementation, and usability of information and computer technologies. The role is also known as chief digital information officer (CIDO)

A chief technology officer (CTO) is the person in charge of an organization's technological demand. This role is also known as a chief technical officer.

From the above explanation; it is clear that the answer is Trina Hauger is a CPO.

5 0
2 years ago
Case Study/Scenario: First, Julio clicks Tools from the Chrome menu on the toolbar. Next, he looks for Manage Add-Ons but can no
Margarita [4]

Answer:

Follows are the solution to this question:

Explanation:

Throughout this scenario, Julio chooses the wrong way to handle the add-ons, instead, he opens the option to search and then type add-ons, where the manager can search for add-ons. It is a software extension that provides an application of additional features. It can broaden certain features, introduce additional features to just the interface surface, or provide extra capabilities for both the system.

4 0
3 years ago
Only cool people answer this question.<br><br><br><br><br> are you cool?
gayaneshka [121]

Answer:

Yes

Explanation:

I like frogs

3 0
2 years ago
Read 2 more answers
manufacturers are making an effort to build energy-efficient computers and use recyclable cases and packaging true or false
Fittoniya [83]
True would be ur answer

Hope I helped:P
7 0
3 years ago
How do u know when a website doesnt like u?
stira [4]
Honest answer a website does not have feelings so therefore there is no way to tell if a website likes you or not!! The reason it may not load is because your IT provider or maybe to firewalls that are set up on your modem. Sometimes its not that and you just need to keep you computer up to date that way it can get on the websites! Hope i helped
3 0
3 years ago
Other questions:
  • Can a Web developer guarantee that data presented is valid? Why or why not?
    9·1 answer
  • Write a program that allows the user to convert a temperature given in degrees from either Celsius to Fahrenheit or Fahrenheit t
    13·1 answer
  • ​PeroxyChem's IT staff was able to free its IT staff to spend less time on routine maintenance and more time on strategic tasks
    11·1 answer
  • Universal Containers is tracking the interviewer's ratings of candidate in Salesforce. They would like to easily link the Candid
    5·1 answer
  • Computer piracy occurs when what is violated
    6·1 answer
  • Which of the following Web sites would be MOST credible?
    6·1 answer
  • When a hoverboard's battery dies, does the hoverboard battery life get impacted the next time the battery is full?
    12·1 answer
  • What is the difference between a crosstab query and a subquery?
    11·2 answers
  • You want to send an email to members of your team working on a school project. In which field would you put the email addresses
    13·1 answer
  • What does Amara hope will<br> happen when Dad sits on the sofa?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!