C Program to Check Eligibility of Students for Engineering or Medical Admission

This program is a mini-project in C programming written using Dev C++ version 5, you can use any standard C compiler to compile the following program.

Advertisements

To help you understand this program, we have the following sections – problem definition, flowchart, program source code, and verified output.

In this C program, we want to compute the following.

  1. Students’ total marks
  2. Compute the cutoff marks
  3. Check if the students are eligible for engineering or medical admission
  4. Display ‘P’ for Pass, ‘F’ for Fail, ‘E’ if eligible for engineering, ‘M’ if eligible for medical admission

Problem Definition

This program require some input from the users. The input to the program is student information.

  • Name
  • Registration

and students mark in following 6 subjects.

Advertisements
  • Language 1
  • Language 2
  • Mathematics
  • Physics
  • Chemistry
  • Biology

One the program receives the input values, it will compute following output.

  • Total marks in all subjects
  • Average marks in all subjects
  • Engineering cutoff marks (Must be greater than or equal to 220 for eligibility)
  • Medical cutoff marks (Must be greater than or equal to 230 for eligibility)
  • Display ‘P’ if student pass in all subjects (All marks greater than 50)
  • Display ‘F’ if student fail in any subject (Mark is less than 50)
  • Display ‘E’ if student passed and eligible for Engineering admission
  • Display ‘M’ if student passed and eligible for medical admission

Let us see how these outputs are calculated.

Total Marks = (Lang1 + Lang2 + Math + Physics + Chemistry + Biology) 
Average Marks = (Lang1 + Lang2 + Math + Physics + Chemistry + Biology)/6
Engineering Cutoff = Math/2+ Physics/4 + Chemistry/4
Medical Cutoff = Math/2 + Biology/4 + Chemistry/4

Flowchart of the Program

Flowchart - Student Eligibility
Flowchart – Student Eligibility

Program Code

/* Program to Compute the marks of student 
and decide cutoff for Engineering and Medical Cutoff */

#include "stdio.h"
#include "conio.h"

#define N 10

struct student{

    char name[20];
    int regno;
    int lang1;
    int lang2;
    int math;
    int physics;
    int chemistry;
    int biology;
    int total;
    int avg;
    char result;
    int engg_cutoff;
    int med_cutoff;

};

main()
{

    struct student stud[100];

    int i,n;

    printf("ENTER THE NUMBER OF STUDENTS:\n");

    scanf("%d",&n);

/* Input Student Details */

printf("____________________________________________________\n\n");


    printf("Student whose Result is P has Passed the Course\n\n");
    printf("Student whose Result is F has Failed the Course\n\n");
    printf("Student whose Result is E has passed \n");
    printf("and eligible for Engineering admission\n\n");
    printf("Student whose Result is M has passed\n");
    printf("and eligible for Medical admission \n\n");

printf("____________________________________________________\n\n");

printf("ENTER STUDENT DETAILS:\n");

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

    printf("ENTER STUDENT NAME:");
    scanf("%s",&stud[i].name);

    printf("ENTER STUDENT REGISTRATION NUMBER:");
    scanf("%d",&stud[i].regno);

    printf("ENTER FIRST LANGUAGE MARKS:");
    scanf("%d",&stud[i].lang1);

    printf("ENTER SECOND LANGUAGE MARKS:");
    scanf("%d",&stud[i].lang2);

    printf("MATH:");
    scanf("%d",&stud[i].math);

    printf("PHYSICS:");
    scanf("%d",&stud[i].physics);

    printf("CHEMISTRY:");
    scanf("%d",&stud[i].chemistry);

    printf("BIOLOGY:");
    scanf("%d",&stud[i].biology);

}

/* Student Results, Total Marks, Average Marks */

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

    if(stud[i].lang1 < 50 || stud[i].lang2 < 50 || 
    stud[i].math < 50 || stud[i].physics < 50 ||
    stud[i].chemistry < 50 || stud[i].biology < 50)
    {

        stud[i].result = 'F';

    }
    else
    {

        stud[i].result = 'P';

    }
}

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

    stud[i].total = 0;

    stud[i].avg = 0;

    stud[i].total = stud[i].lang1 + stud[i].lang2 + 
    stud[i].math + stud [i].physics + 
    stud[i].chemistry + stud[i].biology;

    stud[i].avg = stud[i].total/6;

}

/* Print Student Information */

printf("_______________________________________________________________________________________\n\n");

printf("NAME\tREGNO\tLANG-1\tLANG-2\tMATH\tPHY\tCHEM\tBIO\tTOTAL AVG RESULT\n\n");

printf("________________________________________________________________________________________\n\n");

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

    printf("%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d
    %c\n\n",stud[i].name,stud[i].regno,stud[i].lang1,
    stud[i].lang2,stud [i].math,stud[i].physics,
    stud[i].chemistry,stud[i].biology,stud [i].total,
    stud[i].avg,stud[i].result);

}

printf("*****************************************************************************\n\n");

/* Compute Engineering and Medical Cutoff Marks */

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

stud[i].engg_cutoff = (stud[i].math)/2 + 
(stud[i].physics)/4 + (stud [i].chemistry)/4; 

stud[i].med_cutoff = (stud[i].math)/2 + 
stud [i].biology)/4 + (stud[i].chemistry)/4; 

stud[i].engg_cutoff = stud [i].engg_cutoff + 
stud[i].lang1 + stud[i].lang2; 

stud[i].med_cutoff = stud[i].med_cutoff + 
stud[i].lang1 + stud[i].lang2; 

    if(stud[i].engg_cutoff >= 220 && stud[i].med_cutoff < 230 ) 
    { 

        stud[i].result = 'E'; 

    }
    else if(stud[i].med_cutoff >= 230)
    {

        stud[i].result = 'M';

    }

}

/* Print Student Results and Eligibility */

printf("Name\tTotal\tResult\tMedCO\tEngg_CO\n\n");

printf(______________________________________________\n\n");

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

    printf("%s\t%d\t%c\t%d\t%d\n\n",stud[i].name,
    stud[i].total,stud [i].result,
    stud[i].med_cutoff,stud[i].engg_cutoff);

}

    getch();
    return 0;

}

Output

The initial screen of the program is as follows, make sure that you read the instruction before providing input to the program for correct output.

ENTER THE NUMBER OF STUDENTS:
3
_________________________________________________________________
Student whose Result is P has Passed the Course

Student whose Result is F has Failed the Course

Student whose Result is E has passed
and eligible for Engineering admission

Student whose Result is M has passed
and eligible for Medical admission
________________________________________________________________
ENTER STUDENT DETAILS:
ENTER STUDENT NAME: _

When you provide inputs correctly, you should receive a similar output shown below.

Output - C Program to Check Student Eligibility
Output – C Program to Check Student Eligibility

Advertisements

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.