Skip to content

[NEW ALGORITHM] #4753

Open
Open

Description

@xpmoustafa

#include <stdio.h>
/* Function to compute the final average /
float compute_average (float CA, float PW,
float EX)
{
return 0.3f * CA + 0.2f * PW + 0.5f * EX;
}
/
Function to determine the student's status
1 -> Pass, 2 -> Deferred, 3 -> Fail*/
int get_status (float ave)
{
if (ave >= 10.0f)
return 1;
else if (ave >= 7.0f)
return 2;
else
return 3;
}
int main()
{
float CA, PW, EX;
float ave;
int status;
printf("Enter CA mark: ");
scanf("%f", &CA);
printf("Enter PW mark: ");
scanf("%f", &PW);
printf("Enter EX mark: ");
scanf("%f", &EX);
ave = compute_average(CA, PW, EX);
status = get_status(ave);
printf("\nfinal average: %.2f\n", ave);
if (status == 1)
printf("Status: Pass\n");
else if (status == 2)
printf("Status: Deferred\n");
else
printf("Status: Fail\n");

}

Activity

  1. github-actions commented on May 4, 2026

    @github-actions

    👋 Thank you for raising an issue! We appreciate your effort in helping us improve. Our team will review it shortly. Stay tuned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions