Anasayfa
/
Teknoloji
/
C Programming Assignment: Student Marks Analysis Objective: Write a C Program That Performs the Following Tasks Related to Student

Soru

C Programming Assignment: Student Marks Analysis Objective: Write a C program that performs the following tasks related to student marks analysis: 1. Input: Read the number of students (n) Read the marks of n students into an array using a function. 2. Processing: Use a function to calculate the average marks Use another function to find the highest mark and the lowest mark. Use a function to count how many students scored above average. 3. Output: Print all the marks , the average mark, the highest mark, the lowest mark, and the number of students scoring above average.

Çözüm

4.4 (255 Oylar)
Jihan
Uzman doğrulaması
Profesyonel · 6 yıl öğretmeni

Cevap

Here is a sample C program that performs the tasks mentioned in the objective:```c#include // Function to read the marks of n students into an arrayvoid readMarks(int marks[], int n) { for (int i = 0; i *highest) { *highest = marks[i]; } if (marks[i] avg) { count++; } } return count;}int main() { int n; printf("Enter the number of students: "); scanf("%d", &n); int marks[n]; readMarks(marks, n); float avg = calculateAverage(marks, n); float highest, lowest; findHighestLowest(marks, n, &highest, &lowest); int aboveAvg = countAboveAverage(marks, n, avg); printf("Marks: "); for (int i = 0; i < n; i++) { printf("%d ", marks[i]); } printf("\nAverage mark: %.2f\n", avg); printf("Highest mark: %.2f\n", highest); printf("Lowest mark: %.2f\n", lowest); printf("Number of students scoring above average: %d\n", aboveAvg); return 0;}```This program will prompt the user to enter the number of students and their respective marks. It will then calculate the average, highest, and lowest marks, and count the number of students who scored above the average. Finally, it will print all the marks, the average mark, the highest mark, the lowest mark, and the number of students scoring above average.