What computer language is to be used?
BASIC? FORTRAN? C++ ?
Write a program that asks the user to enter the student’s name (first and last), and his/her first exam grade of three students, and then display them in a neat format. After that the program will find the average of the three grades, and print it
2 answers
program quiz_1;
label xy;
var
StudentName:string;
ExamScore:integer;
TotalExamScore:integer;
TotalStudent:integer;
average:real;
ans:char;
begin
TotalStudent := 0;
TotalExamScore := 0;
xy: write('Please enter StudentName: ');
readln(StudentName);
write('Please enter ExamScore: ');
readln(ExamScore);
if (ExamScore>0) then
begin
TotalStudent :=TotalStudent + 1;
TotalExamScore := TotalExamScore + ExamScore;
end
else
begin
average := TotalExamScore / TotalStudent;
end;
writeln('Name: ', StudentName);
writeln('Your exam score is ', ExamScore);
write('Is there more Student Sir, please type (Y) OR (N) ? >');
readln(ans);
if (ans='Y') then
goto xy;
average := TotalExamScore / TotalStudent;
writeln('The average score is ', average:2:2);
readln;
end.
label xy;
var
StudentName:string;
ExamScore:integer;
TotalExamScore:integer;
TotalStudent:integer;
average:real;
ans:char;
begin
TotalStudent := 0;
TotalExamScore := 0;
xy: write('Please enter StudentName: ');
readln(StudentName);
write('Please enter ExamScore: ');
readln(ExamScore);
if (ExamScore>0) then
begin
TotalStudent :=TotalStudent + 1;
TotalExamScore := TotalExamScore + ExamScore;
end
else
begin
average := TotalExamScore / TotalStudent;
end;
writeln('Name: ', StudentName);
writeln('Your exam score is ', ExamScore);
write('Is there more Student Sir, please type (Y) OR (N) ? >');
readln(ans);
if (ans='Y') then
goto xy;
average := TotalExamScore / TotalStudent;
writeln('The average score is ', average:2:2);
readln;
end.