Question:
I wanted to display the students' grade when all grades were entered, in an array of 10 positions, I tried outside the for, but it only returns the last one.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int notas[10];
int i;
for(i=0; i<10; i++) {
printf("Digite a nota do aluno: %d\n", i);
scanf("%d", ¬as[i]);
printf("A nota do aluno %d e: %d\n", i, notas[i]);
//Ele exibe assim que digito a nota do aluno
}
system("pause");
return 0;
}
Answer:
You can use another for
to show the students' grade.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int notas[10];
int i;
for(i = 0; i < 10; i++) {
printf("Digite a nota do aluno: %d\n", i);
scanf("%d", ¬as[i]);
}
for(i = 0; i < 10; i++){
printf("A nota do aluno %d e: %d\n", i, notas[i]);
}
system("pause");
return 0;
}