Student Performance Management System in R
R Programming – Module 1 Practical Assignment
R Program Code
roll_no <- readline("Enter Your Roll Number: ")
user_name <- readline("Enter Your Name: ")
student_id <- c(101,102,103,104,105)
student_name <- c("Amit","Riya","Kiran","Neha","Arjun")
marks_matrix <- matrix(c(85,78,90,70,65,72,88,92,95,60,58,62,40,45,38),
nrow=5, byrow=TRUE)
calculate_result <- function(sub1,sub2,sub3){
total <- sub1+sub2+sub3
avg <- total/3
if(avg>=75) grade<-"Distinction"
else if(avg>=60) grade<-"First Class"
else if(avg>=50) grade<-"Second Class"
else grade<-"Fail"
return(list(Total=total,Average=avg,Grade=grade))
}
Sample Output
ID Name S1 S2 S3 Total Avg Grade
101 Amit 85 78 90 253 84.33 Distinction
102 Riya 70 65 72 207 69.00 First Class
103 Kiran 88 92 95 275 91.67 Distinction
104 Neha 60 58 62 180 60.00 First Class
105 Arjun 40 45 38 123 41.00 Fail