Show students' grade in C

4

I wanted to display the students note when I typed all the notes, in an array of 10 positions, I tried out of for, but it returns me only 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", &notas[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;
}
    
asked by anonymous 16.05.2015 / 21:40

1 answer

1

You can use another for to show 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", &notas[i]);
    }

    for(i = 0; i < 10; i++){
        printf("A nota do aluno %d e: %d\n", i, notas[i]);
    }
    system("pause");
    return 0;
}

Exemplo

    
16.05.2015 / 21:46