0% found this document useful (0 votes)
21 views2 pages

Include - Stdio.

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Include - Stdio.

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

#include <stdio.

h>

#include <string.h>

// Define a structure for a student

struct Student {

char name[20];

float math;

float pc; // Physical Chemistry (PC)

float sn; // Natural Sciences (SN)

float frs; // French (FRS)

float ang; // English (ANG)

};

int main() {

// Create an array of students with their respective grades

struct Student classroom[] = {

{"André", 14.0, 15.0, 12.0, 5.0, 14.0},

{"Andos", 12.5, 10.0, 15.0, 12.0, 13.0},

{"Bertrand", 7.5, 9.0, 12.0, 14.0, 14.0},

{"Bodo", 10.0, 10.5, 13.0, 13.5, 12.0},

{"Celine", 11.25, 9.75, 10.5, 10.0, 11.0},

{"Cellesse", 9.75, 10.0, 12.0, 11.0, 14.0},

{"David", 16.0, 11.0, 12.0, 9.75, 15.0}

};
// Number of students

int n = sizeof(classroom) / sizeof(classroom[0]);

// Display the data

printf("Student Data Bank:\n");

printf("Name MATH PC SN FRS ANG\n");

printf("-----------------------------------------\n");

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

printf("%-10s %.2f %.2f %.2f %.2f %.2f\n",

classroom[i].name,

classroom[i].math,

classroom[i].pc,

classroom[i].sn,

classroom[i].frs,

classroom[i].ang);

return 0;

You might also like