Display student grade in C

Asked

Viewed 536 times

4

I wanted to display the student grade when all the notes were typed, in an array of 10 positions, I tried out for, but it returns me only the last.

#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;
}

1 answer

1


You can use another for to show students' grades.

#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

  • @user25141 Another example? to calculate the average, one way is to use the harmonic mean. Here have an example.

  • Vlw, I’ll test it here...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.