Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* CABEÇALHO
- Arquivo: LISTA 06 - Exercicio 6.c
- Objetivo: Exibir nome do aluno que possui maior media.
- Autor(a): Ramon Borges
- */
- #include <stdio.h>
- #define MAX 5
- struct info
- {
- char nome[30];
- float media;
- };
- int main()
- {
- struct info alunos[MAX];
- int i, maior = 0;
- for(i = 0; i < MAX; i++)
- {
- printf("\nInforme o nome do %d aluno: ", i+1);
- fflush(stdin);
- gets(alunos[i].nome);
- printf("\nInforme sua media: ");
- scanf("%f", &alunos[i].media);
- }
- for(i = 0; i < MAX; i++)
- if(alunos[i].media > alunos[maior].media)
- maior = i;
- printf("\nMAIOR MEDIA: %s", alunos[maior].nome);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment