Write a program in Pascal language that allows the user to enter a student’s name and
mark obtained in a Maths examination. The program should prompt the user to enter name and
mark, check that mark is in the range 0 <= mark <= 100 otherwise asks for the mark
again. The program outputs the student’s name and grade. Grades are awarded according
to the following grade boundaries.
80 < mark <= 100 grade A
60 < mark <= 80 grade B
40 < mark <= 60 grade C
mark <= 40 failed
...............................................solution.................................................................................
PROGRAM GradePoint;
var
Name:string;
score: 1..100;
begin
writeln('please enter your name!');
readln(name);
writeln('please enter your score(1-100)');
readln(score);
if(score 80<=100)then
writeln('your grade is A');
if(score 60<=80)then
writeln('your grade is B');
if(score 40<=60)then
writeln('your grade is C');
if(score <=40) then
writeln('your grade is E');
ENDIF
end.
mark obtained in a Maths examination. The program should prompt the user to enter name and
mark, check that mark is in the range 0 <= mark <= 100 otherwise asks for the mark
again. The program outputs the student’s name and grade. Grades are awarded according
to the following grade boundaries.
80 < mark <= 100 grade A
60 < mark <= 80 grade B
40 < mark <= 60 grade C
mark <= 40 failed
...............................................solution.................................................................................
PROGRAM GradePoint;
var
Name:string;
score: 1..100;
begin
writeln('please enter your name!');
readln(name);
writeln('please enter your score(1-100)');
readln(score);
if(score 80<=100)then
writeln('your grade is A');
if(score 60<=80)then
writeln('your grade is B');
if(score 40<=60)then
writeln('your grade is C');
if(score <=40) then
writeln('your grade is E');
ENDIF
end.
0 comments:
Post a Comment