Created
May 24, 2022 13:42
-
-
Save saharshg29/e210a551a95ea7bb64f5a42ee90eab6a to your computer and use it in GitHub Desktop.
Program 11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| struct student | |
| { | |
| char firstName[50]; | |
| int regno; | |
| int marks1; | |
| int marks2; | |
| int marks3; | |
| int marks4; | |
| int marks5; | |
| float percentage; | |
| } s[5]; | |
| int main() | |
| { | |
| int i; | |
| printf("Enter information of students:\n"); | |
| // storing information | |
| for (i = 0; i < 5; ++i) | |
| { | |
| s[i].regno = i + 1; | |
| printf("\nFor regno number%d,\n", s[i].regno); | |
| printf("Enter first name: "); | |
| scanf("%s", s[i].firstName); | |
| printf("Enter marks (max 10): "); | |
| scanf("%i", &s[i].marks1); | |
| scanf("%i", &s[i].marks2); | |
| scanf("%i", &s[i].marks3); | |
| scanf("%i", &s[i].marks4); | |
| scanf("%i", &s[i].marks5); | |
| s[i].percentage = (s[i].marks1 + s[i].marks2 + s[i].marks3 + s[i].marks4 + s[i].marks5) * 2; | |
| } | |
| printf("\n \n Displaying Information:\n\n"); | |
| // displaying information | |
| for (i = 0; i < 5; ++i) | |
| { | |
| printf("\nregno number: %d\n", i + 1); | |
| printf("First name: %s ", s[i].firstName); | |
| printf("Marks: %i %i %i %i %i ", s[i].marks1, s[i].marks2, s[i].marks3, s[i].marks4, s[i].marks5); | |
| printf("Percentage scored: %f \%", s[i].percentage); | |
| printf("\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment