Asked by ayham
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
Answers
Answered by
drwls
What computer language is to be used?
BASIC? FORTRAN? C++ ?
BASIC? FORTRAN? C++ ?
Answered by
Alves
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.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.