Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- struct tipoaluno {
- float nota;
- char nome [20];
- char matricula [10];
- };
- int main()
- {
- struct tipoaluno alunos[3];
- int i;
- for (i=0; i<3; i++){
- printf("\n Informe o nome do aluno:");
- fgets(alunos[i].nome, 20, stdin);
- setbuf(stdin,NULL);
- printf("\n Informe a matricula:");
- fgets(alunos[i].matricula, 10, stdin);
- setbuf(stdin,NULL);
- printf ("\n Informe a nota:");
- scanf("%f", &alunos[i].nota);
- setbuf(stdin,NULL);
- }
- for(i=0;i<3;i++){
- printf ("\n\n O aluno %s, matricula: %s, obteve a nota: %.2f: ", aluno[i].nome, alunos[i].matricula, aluno[i].nota);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement