0% found this document useful (0 votes)
13 views3 pages

Programming

The document outlines a program that calculates the total and average marks for students based on their scores in various subjects. It assigns grades (distinction, merit, pass, fail) based on the average marks and counts the number of students who fail. The program uses predefined arrays for student names and marks, iterating through them to compute the required outputs.

Uploaded by

Usha Perumal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Programming

The document outlines a program that calculates the total and average marks for students based on their scores in various subjects. It assigns grades (distinction, merit, pass, fail) based on the average marks and counts the number of students who fail. The program uses predefined arrays for student names and marks, iterating through them to compute the required outputs.

Uploaded by

Usha Perumal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Variables

array1 : student_name
array 2: student_mark
array3: class_size
array4: subject number

Greater than or equal to 70 = distinction


Greater than or equal to 70 = distinction
Greater than or equal to 45 = merit
Greater than or equal to 55 = merit
Lesser than 40 = Fail
First section
For i = 0 to ClassSize - 1 do

TotalMark ← 0

For j = 0 to SubjectNo - 1 do

TotalMark = TotalMark + StudentMark[i]

End For

AverageMark be round(TotalMark / SubjectNo)

Grade in “”

If AverageMark >= 70 then

Grade = "distinction"

Else If AverageMark >= 55 then

Grade = "merit"

Else If AverageMark >= 40 then

Grade = "pass"

Else

Grade = "fail"

FailCount = FailCount + 1

End If

Output StudentName[i], TotalMark, AverageMark, Grade


PROGRAMMING

StudentName = ["Apple", "Ball", "Grapes", "Cucumber", "Pineapple"]


StudentMark = [[75, 80, 70], [60, 70, 80], [90, 85, 95], [40, 50, 60], [35, 30,
40]]
ClassSize = len(StudentName)

For i in range(ClassSize):
TotalMark = sum(StudentMark[i])
AverageMark = round(TotalMark / SubjectNo)

if AverageMark >= 70:


Grade = "distinction"
Elif AverageMark >= 55:
Grade = “merit”
Elif AverageMark >= 40:
Grade = “Pass”
else :
Grade = “Fail’

Print ( {Student name[i]}: TotalMark = {TotalMark}, AverageMark = { AverageMark})

You might also like