+1 vote
323 views
in Programming Languages & Algorithms by
The pass mark is 40 marks.The sentinel that allows the user to exit the loop is any negative number. The program ignores any mark greater than 100.

1 Answer

+1 vote
by (user.guest)
selected by (user.guest)
 
Best answer

This program will be written in python 

n = int(input('Enter Any Size of Class: '))

pass_student = 0

fail_student = 0

sum = 0

for i in range(n):

    mark = int(input("Enter Marks (0 - 100): "))

    if mark < 0:

        print('Invalid Marks!!!')

        break

    elif mark >= 40:

        pass_student = pass_student + 1

        sum += mark

    else: # 0 <= mark < 40

        fail_student = fail_student + 1

        sum += mark

print('The Total Passed Student: ', pass_student)

print('The Total Failed Student: ', fail_student)


Related questions

+1 vote
1 answer 807 views
+1 vote
1 answer 165 views
+1 vote
1 answer 276 views
+1 vote
1 answer 2.7k views
Welcome to CPENTalk.com
Solution-oriented students of computer engineering on one platform to get you that

ONE SOLUTION

...