Question

Write a C Program. Given a 50 x 5 matrix, consisting of 5 quiz grades of...

Write a C Program.

Given a 50 x 5 matrix, consisting of 5 quiz grades of 50 students, find and display the fourth quiz grade of the student who got 25 from the third quiz, if any.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the C code for the above task. I allocated a random grade array between 0 and 50 to each student in each quiz for testing. You should use the original grade array instead of this.

#include <stdio.h>

#include <stdbool.h>

#include <stdlib.h>

int main() {

   int grades[50][5]; // grades array 50 x 5

   // randomly fill grades between 0 and 50

   int i, j;

   for(i = 0; i < 50; ++i) {

       for(j = 0; j < 5; ++j) {

           grades[i][j] = rand() % 51;

       }

   }

   // check for students who got 25 from the third quiz

   // and display the fourth quiz grade

  

   bool noStudent = true; // if no student got 25 in third quiz

   for(i = 0; i < 50; ++i) { // loop through each student

       if(grades[i][2] == 25) { // if third quiz grade is 25

           printf("Student #%d, Fourth quiz grade: %d\n", i + 1, grades[i][3]);

           noStudent = false;

       }

   }

   if(noStudent) { // if No student got 25 in third quiz

       printf("No student met the criteria!\n");

   }

   return 0;

}

Code Screenshot:

C main.c>... #include <stdio.h> 2 #include <stdbool.h> #include <stdlib.h> int main() { int grades [50][5]; // grades array 5

Sample IO:
[unseen@x510unr]08:53 am_$ -/prog/ -> gcc main.c [unseen@x510unr]08:53 am_$ -/prog/ -> /a.out Student #23, Fourth quiz grade:

Add a comment
Know the answer?
Add Answer to:
Write a C Program. Given a 50 x 5 matrix, consisting of 5 quiz grades of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a code that gets the quiz grades of a class. A matrix with n rows...

    Write a code that gets the quiz grades of a class. A matrix with n rows and m columns where n stands for number of students and m is the number of quizzes. Let’s call the matrix A. Then, your code drops the lowest grade of each student and remove it from the matrix. Also, it finds the average grade for the quizzes for each student and add a new column to the end the matrix. in matlab please

  • Write a Python Program Display the grades: Input: Enter the marks of the student Condition: Grade...

    Write a Python Program Display the grades: Input: Enter the marks of the student Condition: Grade A: Marks greater than 90 Grade B: Marks range from 81 to 90 Grade C: Marks range from 65 to 80 Fail: less than 65 Display the output. Example: Input: 95 Display: “student got Grade A” Input: 80 Display: “student got Grade C” Input: 64 Display: “student failed” Hint: Use else if (elif and logical operators)

  • In this assignment, you will write a program in C++ which uses files and nested loops...

    In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...

  • Are grades higher on the second quiz? Here is a sample of grades from a large introductory statis...

    Are grades higher on the second quiz? Here is a sample of grades from a large introductory statistics course. We are interested in testing whether the mean grade on the second quiz is higher than the mean grade on the first quiz. You may assume any required test assumptions have been met. a) Complete the test if we assume that the grades from the first quiz come from a random sample of 12 students in the course and the grades...

  • C++ Write a program to calculate final grade in this class, for the scores given below...

    C++ Write a program to calculate final grade in this class, for the scores given below . Remember to exclude one lowest quiz score out of the 4 while initializing the array. Display final numeric score and letter grade. Use standard include <iostream> Implementation: Use arrays for quizzes, labs, projects and exams. Follow Sample Output for formatting. May use initialization lists for arrays. Weight distribution is as follows: Labs: 15% Projects: 20% Quizzes: 20% Exams: 25% Final Project: 20% Display...

  • Write a C++ program that defines a structure called StudentInfo for records consisting of a student’s...

    Write a C++ program that defines a structure called StudentInfo for records consisting of a student’s ID, age, final grade for math, final grade for reading, and final grade for music. Define an array of such records to hold up to eight students’ records that the user input students’ information from the keyboard. Then compute and print out the average of their math grades and average of reading, and each student’s average grade of math, reading and music .

  • Write a C++ program that computes student grades for an assignment as a percentage given each...

    Write a C++ program that computes student grades for an assignment as a percentage given each student's score and the total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath header file and displayed as a percentage. You must also display the floating-point result up to 5 decimal places. You must use at least 2 functions: one to print the last name of the student and another function to...

  • (Find the max grade) Write a C++ program that receives the grades for an unknown number...

    (Find the max grade) Write a C++ program that receives the grades for an unknown number of students and finds and displays the maximum grade. -1 is the last grade. Enter the grades (Enter -1 if done): 65 48 83 93 -1 The maximum is 93

  • please use the c language Assignment 12 The program to write in this assignment is a...

    please use the c language Assignment 12 The program to write in this assignment is a program that calculates score statistics and manages the grades of the students. First, the student list and are given in a file named "student.dat" as in the following: 이성우 77 홍길동 88 scores 201 1710086 2012700091 This program reads the input file "student.dat" and keeps this data in a linear linked list. Each node must be a struct which contains the following: student id...

  • using C# Write a program which calculates student grades for multiple assignments as well as the...

    using C# Write a program which calculates student grades for multiple assignments as well as the per-assignment average. The user should first input the total number of assignments. Then, the user should enter the name of a student as well as a grade for each assignment. After entering the student the user should be asked to enter "Y" if there are more students to enter or "N" if there is not ("N" by default). The user should be able to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT