Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Assignment5.c #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Assignment5.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,41 @@

int main()
{
int marks[50], n, max_score = 0, passed = 0, failed = 0, absent = 0;
printf("ENTER THE NUMBER OF STUDENTS (maximum 50): ");
scanf("%d", &n);

printf("\nENTER THE MARKS OF EACH STUDENT HERE(enter -1 for absent student):\n");

for (int i = 0; i < n; i++)
{
printf("ENTER THE MARKS OF STUDENT %d: ", i + 1);
scanf("%d", &marks[i]);
if (marks[i] > max_score)
{
max_score = marks[i];
}
}

for (int i = 0; i < n; i++)
{
if (marks[i] == -1)
{
absent++;
}
else if (marks[i] >= 50)
{
passed++;
}
else
{
failed++;
}
}

printf("\n\t Maximum score is: %d\n", max_score);
printf("\n\t total number of students passed: %d\n", passed);
printf("\n\t total number of students failed: %d\n", failed);
printf("\n\t total number of students absent: %d\n", absent);
return 0;
}