-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstdStruct.c
More file actions
77 lines (73 loc) · 1.97 KB
/
Copy pathstdStruct.c
File metadata and controls
77 lines (73 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*-------------------------------------------------------------------------------------------------------------------------------
stdStruct.c
Program to print student data using structures
DIVYA RAJ K
09-11-2018
---------------------------------------------------------------------------------------------------------------------------------*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct StudentType{
int Regno;
char Name[30];
int Mk1;
int Mk2;
int Mk3;
int Total;
float Avg;
int Result;
};
struct StudentType S;
main()
{
system("clear");
printf("Program to print student marks card using structures\n\n");
printf("Enter the register number: ");
scanf("%d",&S.Regno);
printf("Enter the student name: ");
scanf("%s",S.Name);
printf("Enter the marks in Physics: ");
scanf("%d",&S.Mk1);
printf("Enter the marks in Chemistry: ");
scanf("%d",&S.Mk2);
printf("Enter the marks in Maths: ");
scanf("%d",&S.Mk3);
system("clear");
S.Total=S.Mk1+S.Mk2+S.Mk3;
S.Avg=S.Total/3.0;
if(S.Avg>=40 && S.Mk1>=35 && S.Mk2>=35 && S.Mk3>=35){
if(S.Avg<=50){
S.Result=3;
}else if(S.Avg<=60){
S.Result=2;
}else if(S.Avg<=70){
S.Result=1;
}else{
S.Result=0;
}
}else{
S.Result=-1;
}
printf("\n-------------------------------------------------------------------------\n");
printf("\tST.ALOYSIUS COLLEGE RESULTS\n");
printf("\t\tSTUDENT REPORT");
printf("\n-------------------------------------------------------------------------\n");
printf("Register Number:%d",S.Regno);
printf("\nName:\t\t%s",S.Name);
printf("\nPhysics:\t%d",S.Mk1);
printf("\nChemistry:\t%d",S.Mk2);
printf("\nMaths:\t\t%d",S.Mk3);
printf("\nTOTAL MARKS:\t%d",S.Total);
printf("\nAVERAGE:\t%.2f",S.Avg);
if(S.Result==-1){
printf("\nRESULT:\t\tFAIL");
}else if(S.Result==0){
printf("\nRESULT:\t\tDISTINCTION");
}else if(S.Result==1){
printf("\nRESULT:\t\tFIRST CLASS");
}else if(S.Result==2){
printf("\nRESULT:\t\tSECOND CLASS");
}else{
printf("\nRESULT:\t\tTHIRD CLASS");
}
}