Develop a C program that stores and access enrollment_no, name and percentage for 3 students and display it on screen using array of structure.

Code

#include <stdio.h>
struct student {
char name[50];
int enroll;
float percentage;
} s[3]; // array

int main() {
int i;
printf("Enter information of students:\n");

// storing information
for (i = 0; i < 3; ++i) {

printf("\nEnter enroll number:");
scanf("%d", &s[i].enroll);
printf("Enter first name: ");
scanf("%s", s[i].name);
printf("Enter percentage: ");
scanf("%f", &s[i].percentage);
}
printf("Displaying Information:\n\n");

// displaying information
for (i = 0; i < 3; ++i) {
printf("\nEnroll number: %d\n", s[i].enroll);
printf("First name: ");
puts(s[i].name);
printf("percentage: %.2f", s[i].percentage);
printf("\n");
}
return 0;
}

Output



I also hate to write code on paper