-2
I need to create a program with functions, but I could not fix the repetition commands.
Program: Read the number of students in the classroom. For each of the n students you must do the following: Read the name, the notes of 3 tests P1, P2 and Psub and the notes of 3 exercises-program EP1, EP2 and EP3. Then calculate and print P (the average of the tests) and EP (the average of the exercises-program), MF (the final grade) and finally the situation (approved, in recovery or failed in note).
I am fine at the beginning, but my program when inserting a repeat command, and when putting to print, it only print the last data inserted
n <- as.numeric(readline("Digite o numero de alunos: "))
for (i in 1:n) {
nome <- readline("Digite o nome do aluno: ")
p1<- as.numeric(readline("Digite a nota da P1: "))
p2<- as.numeric(readline("Digite a nota da P2: "))
p3<- as.numeric(readline("Digite a nota da P3: "))
}
print(paste0(n, nome, p1, p2, p3))
Hello Matheus, welcome to the OS in Portuguese. If you are starting on the site, see Help Center to know how the OS works, especially the topic on how to ask good questions.
– Carlos Eduardo Lagosta