forked from sarthakd999/Hacktoberfest2021-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathData record system in a school
More file actions
45 lines (34 loc) · 1.58 KB
/
Data record system in a school
File metadata and controls
45 lines (34 loc) · 1.58 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
//program to check the validity of data recorded for the students at a college
#include<stdio.h>
void main()
{
int id,error=0; //id-student id number
char type; //type-course type as part time (P) or full time(F)
float fee,avg_mark; //fee-fees paid for the tution, average marks-average mark of the student
printf("Enter the Id, Type, Average marks and Fee : \n");
scanf("%d,%c,%f,%f",&id,&type,&avg_mark,&fee);
while(id>0)
{
if(id<1000 || id>9999) //id number should be between 1000 and 9999 inclusive
error++;
if(type!='P' && type!='F') //course type should be “P” or “F”
error++;
if(avg_mark<0 ||avg_mark>100) //average marks must be between 0 and 100 inclusive
error++;
if(type=='P')
{
if(fee>200000) //fees paid for part-time should not exceed Rs.200000
error++;
}
else
if(type=='F') //fees
{
if(fee>500000) //fees paid for fulltime should not exceed Rs.500000
error++;
}
printf("%d errors\n",error);
error=0;
printf("Enter the Id, Type, Average Marks and Fee : \n");
scanf("%d, %c, %f, %f",&id,&type,&avg_mark,&fee);
}
}