Create an algorithm for grading systems of your class student’s Quarterly examination
marks by satisfying all necessary conditions.
plzz. hurry up
Answers
Grading system.
- For the grading system, we can make use of the if-else-if ladder.
- In the if-else-if ladder, we check a condition in the first if clause, if it is true then execute the particular statements or check another condition in the else if clause.
- And further, we can add as many conditions as required.
- The ladder ends with an else clause. This else clause is not compulsory.
Python Code:
marks = int(input("Enter the marks: "))
if marks >= 90:
print("Grade A")
else if marks >= 80:
print("Grade B")
else if marks >= 70:
print("Grade C")
else if marks >= 60:
print("Grade D")
else:
print("Grade E")
#SPJ2
Answer:
The Algorithm is given for the statement
Explanation:
- Every student receives a grade in the inclusive range from 0 to 100.
- Any grade less than 40 is a failing grade.
- Sam is a professor at the university and likes to round each student’s grade according to these rules:
- If the difference between the grade and the next multiple of 5 is less than 3, round grade up to the next multiple of 5.
- If the value of grade is less than 38, no rounding occurs as the result will still be a failing grade.
- grade = 84 round to 85 (85 – 84 is less than 3)
- grade = 29 do not round (result is less than 40)
- grade = 57 do not round (60 – 57 is 3 or higher)
- Given the initial value of grade for each of Sam’s n students, write code to automate the rounding process.
Function Description
Complete the function gradingStudents in the editor below.
gradingStudents has the following parameter(s):
int grades[n]: the grades before rounding
Returns
int[n]: the grades after rounding as appropriate
Input Format
The first line contains a single integer, n, the number of students.
Each line i of the n subsequent lines contains a single integer, grades[i].
Explanation
Student 1 received a 73, and the next multiple of 5 from 73 is 75. Since 75 – 73 < 3, the student’s grade is rounded to 75.
Student 2 received a 67, and the next multiple of 5 from 67 is 70. Since 70 – 67 = 3, the grade will not be modified and the student’s final grade is 67.
Student 3 received a 38, and the next multiple of 5 from 38 is 40. Since 40 – 38 < 3, the student’s grade will be rounded to 40.
Student 4 received a grade below 33, so the grade will not be modified and the student’s final grade is 33.
Program
#include <bits/stdc++.h>
using namespace std;
void solution() {
int n, x;
cin>>n;
for(int i=0; i<n; i++){
cin>>x;
if(x>=38 and x%5>=3){
while(x%5!=0){
x++;
}
}
cout<<x<<endl;
}
}
int main () {
solution();
return 0;
}
Link
- https://brainly.in/question/49346108