![]() |
Giving pupils grades based on their performance is a frequent practise in educational environments. This program’s goal is to automatically grade students in accordance with their test results. The programme will assess a student’s performance and compute the corresponding grade using if-else statements in R. This automation not only speeds up the grading process but also guarantees fairness and consistency. The If-Else statement is used when we need to perform a particular task based on a condition. The If block executes if the condition is true else the Else block is executed. Grade Assignment Based on Percentage for Student’s MarksGiven an integer array marks, which comprises of marks scored by a student (out of 100) in different subjects, the task is to assign a grade to the student. The grade is found out by taking the percentage of the marks scored by the student. The percentage is calculated as:
The grade is assigned using the following rules
Approach:
Below is the approach to solve the problem:
Below is the implementation of the above approach in R language: R
Output: [1] "A" Time complexity: O(N), Where N is the number of elements in the array. Here in the above code we have find out the sum of the array elements using sum() function. and then find the percentage of the marks obtained by the students by using the formula mentioned in the article, Based on their percentage, we have given Grades(A, B, C, D, E) to the students. Grade Classification on student’s score using If-ElseSuppose There is a class- test of Programming Language, In which students got different marks Out of 50. If the students will get some Grade Based on the below table:
Write a program to assign grades based on student’s score using If -Else Satatement in R: Below is the implementation using If-Else Statement: R
Output: Student 1 got: 45 marks. Grade: Excellent In the above program, we have declared a function that will print the Grade of the Students according to their Marks using If-else Statement. ConclusionIn conclusion, if-else programming expressions are a useful tool for automating the grading process based on student achievement. We guarantee fairness and uniformity in the grading process by analysing their results and implementing particular guidelines. These programmes streamline the grading process and save time for teachers, whether they use a predefined grading scale or percentage calculations to determine grades. This strategy improves the precision and objectivity of grade assignment in educational settings while also being effective. |
Reffered: https://www.geeksforgeeks.org
R Programs |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 15 |