A C program to calculate total & average of score of student selected and display it – IGNOU MCA Assignment 2014 – 15

By | July 14, 2014

MASTER OF COMPUTER APPLICATIONS
Course Code : MCS-011
Course Title : Problem Solving and Programming
Assignment Number : MCA(1)/011/Assign/2014-15
Maximum Marks : 100
Weightage : 25%

 

Write an interactive C program to calculate the total and average of scores of a selected student. The program should prompt the student to input the stu_id. This stu_id is checked against the stu-ids’ and make sure it really exists. Calculate the total and average, if the scores in assignemnt1 (out of 10 marks), assignment2 (out of 10 marks), mid-term score (out of 30 marks), and final score (out of 50 marks) are given.

 

#include<stdio.h>
struct student
{
unsigned long int ENROL;
char NAME[15];
int ASGN1,ASGN2,MIDT,FINL;
}STUD[12]={
{102038400,"GANESH",5,7,25,32},
{102038401,"MAHESH",8,6,21,35},
{102038402,"SURESH",5,4,23,40},
{102038403,"KALPESH",8,9,24,36},
{102038404,"RAHUL",4,6,25,36},
{102038405,"SUBBU",9,8,16,48},
{102038406,"RAKESH",5,7,18,34},
{102038407,"ATUL",5,8,19,41},
{102038408,"DHARMESH",5,7,22,32},
{102038409,"AJAY",5,4,20,36},
{102038410,"ABDUL",7,6,24,41},
{102038411,"RASHMI",6,5,25,34}
};
void main()
{
unsigned long int ENROL_NO;
void gen_result(unsigned long int);
clrscr();
printf("ENTER THE Enroll bwtn 102038400 to 8411 : ");
scanf("%ld",&ENROL_NO);
if(ENROL_NO>102038399 && ENROL_NO<102038412)
gen_result(ENROL_NO);
else
printf("\nYOU HAVE ENTERED WRONG ENROLMENT NO. !!");
getch();
}
void gen_result(unsigned long int ENROL)
{
char STATUS;
int AVG,TOTL;
printf("\n\t\t\tINDIRA GANDHI NATIONAL OPEN UNIVERSITY");
printf("\n\t\t\tTERM-END EXAMINATION (DEC - 2013)");
printf("\n\n\tENROLMENT NO.\t: %ld",ENROL);
printf("\n\tNAME\t\t: %s",STUD[ENROL-102038400].NAME);
printf("\n\tPROGRAMME CODE \t: MCA");
printf("\n\tCOURSE CODE \t: MCS011");
printf("\n\t_______________________________________________________________");
printf("\n\t NAME \t\t ACTUAL MARKS \tOUT OF 100 MARKS\tSTATUS");
printf("\n\t_______________________________________________________________");
if(STUD[ENROL-102038400].ASGN1<4) STATUS='N'; else STATUS='S';
printf("\n\tASSIGNMENT1\t\t%d\t\t%d\t\t%cC",STUD[ENROL-102038400].ASGN1,STUD[ENROL-102038400].ASGN1*10,STATUS);
if(STUD[ENROL-102038400].ASGN2<4) STATUS='N'; else STATUS='S';
printf("\n\n\tASSIGNMENT2\t\t%d\t\t%d\t\t%cC",STUD[ENROL-102038400].ASGN2,STUD[ENROL-102038400].ASGN2*10,STATUS);
if(STUD[ENROL-102038400].MIDT<12) STATUS='N'; else STATUS='S';
printf("\n\n\tMID TERM\t\t%d\t\t%d\t\t%cC",STUD[ENROL-102038400].MIDT,(STUD[ENROL-102038400].MIDT*10)/3,STATUS);
if(STUD[ENROL-102038400].FINL<20) STATUS='N'; else STATUS='S';
printf("\n\n\tFINAL\t\t\t%d\t\t%d\t\t%cC",STUD[ENROL-102038400].FINL,STUD[ENROL-102038400].FINL*2,STATUS);
TOTL=STUD[ENROL-102038400].ASGN1+STUD[ENROL-102038400].ASGN2+STUD[ENROL-102038400].MIDT+STUD[ENROL-102038400].FINL;
AVG=(STUD[ENROL-102038400].ASGN1*10+STUD[ENROL-102038400].ASGN2*10+(STUD[ENROL-102038400].MIDT*10)/3+STUD[ENROL-102038400].FINL*2)/4;
printf("\n\t_______________________________________________________________");
printf("\n\t\t\tTOTAL: %d\tAVG : %d",TOTL,AVG);
printf("\n\t_______________________________________________________________");
printf("\n\t\tSC :- SUCCESSFULL COMPLETED\tNC :- NOT COMPLETED");
}

 

Code:

[codesyntax lang=”c”]

#include<stdio.h>
struct student
{
unsigned long int ENROL;
char NAME[15];
int ASGN1,ASGN2,MIDT,FINL;
}STUD[12]={
{102038400,"GANESH",5,7,25,32},
{102038401,"MAHESH",8,6,21,35},
{102038402,"SURESH",5,4,23,40},
{102038403,"KALPESH",8,9,24,36},
{102038404,"RAHUL",4,6,25,36},
{102038405,"SUBBU",9,8,16,48},
{102038406,"RAKESH",5,7,18,34},
{102038407,"ATUL",5,8,19,41},
{102038408,"DHARMESH",5,7,22,32},
{102038409,"AJAY",5,4,20,36},
{102038410,"ABDUL",7,6,24,41},
{102038411,"RASHMI",6,5,25,34}
};
void main()
{
unsigned long int ENROL_NO;
void gen_result(unsigned long int);
clrscr();
printf("ENTER THE Enroll bwtn 102038400 to 8411 : ");
scanf("%ld",&ENROL_NO);
if(ENROL_NO>102038399 && ENROL_NO<102038412)
gen_result(ENROL_NO);
else
printf("\nYOU HAVE ENTERED WRONG ENROLMENT NO. !!");
getch();
}
void gen_result(unsigned long int ENROL)
{
char STATUS;
int AVG,TOTL;
printf("\n\t\t\tINDIRA GANDHI NATIONAL OPEN UNIVERSITY");
printf("\n\t\t\tTERM-END EXAMINATION (DEC - 2013)");
printf("\n\n\tENROLMENT NO.\t: %ld",ENROL);
printf("\n\tNAME\t\t: %s",STUD[ENROL-102038400].NAME);
printf("\n\tPROGRAMME CODE \t: MCA");
printf("\n\tCOURSE CODE \t: MCS011");
printf("\n\t_______________________________________________________________");
printf("\n\t NAME \t\t ACTUAL MARKS \tOUT OF 100 MARKS\tSTATUS");
printf("\n\t_______________________________________________________________");
if(STUD[ENROL-102038400].ASGN1<4) STATUS='N'; else STATUS='S';
printf("\n\tASSIGNMENT1\t\t%d\t\t%d\t\t%cC",STUD[ENROL-102038400].ASGN1,STUD[ENROL-102038400].ASGN1*10,STATUS);
if(STUD[ENROL-102038400].ASGN2<4) STATUS='N'; else STATUS='S';
printf("\n\n\tASSIGNMENT2\t\t%d\t\t%d\t\t%cC",STUD[ENROL-102038400].ASGN2,STUD[ENROL-102038400].ASGN2*10,STATUS);
if(STUD[ENROL-102038400].MIDT<12) STATUS='N'; else STATUS='S';
printf("\n\n\tMID TERM\t\t%d\t\t%d\t\t%cC",STUD[ENROL-102038400].MIDT,(STUD[ENROL-102038400].MIDT*10)/3,STATUS);
if(STUD[ENROL-102038400].FINL<20) STATUS='N'; else STATUS='S';
printf("\n\n\tFINAL\t\t\t%d\t\t%d\t\t%cC",STUD[ENROL-102038400].FINL,STUD[ENROL-102038400].FINL*2,STATUS);
TOTL=STUD[ENROL-102038400].ASGN1+STUD[ENROL-102038400].ASGN2+STUD[ENROL-102038400].MIDT+STUD[ENROL-102038400].FINL;
AVG=(STUD[ENROL-102038400].ASGN1*10+STUD[ENROL-102038400].ASGN2*10+(STUD[ENROL-102038400].MIDT*10)/3+STUD[ENROL-102038400].FINL*2)/4;
printf("\n\t_______________________________________________________________");
printf("\n\t\t\tTOTAL: %d\tAVG : %d",TOTL,AVG);
printf("\n\t_______________________________________________________________");
printf("\n\t\tSC :- SUCCESSFULL COMPLETED\tNC :- NOT COMPLETED");
}

[/codesyntax]

Screen Shots:

C_program_Student_Evaluation

 C_program_Student_Evaluation_Output

Leave a Reply