Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <bits/stdc++.h>
- #define tamn 5
- #define tamno 5
- void menu(){
- printf("\n1 - Nome do aluno\n");
- printf("2 - Digitar notas do aluno\n");
- printf("3 - Exibir nome e media do aluno\n");
- printf("4 - Exibir todas as notas digitadas\n");
- printf("5 - Sair\n");
- }
- int main(){
- int numero, cont, i, x;
- char nome[tamn];
- float notas[tamno], soma, media;
- do {
- menu();
- scanf("%d", &numero);
- switch(numero)
- {
- case 1 :
- printf("\nDigite um nome:\n");
- scanf(" %[^\n]s", nome);
- break;
- case 2 :
- for(i=0;i<tamno;i++){
- printf("\n Digite nota:\n");
- scanf("%f", ¬as[i]);
- }
- break;
- case 3 :
- printf("\n%s\n", nome);
- for(i=0;i<tamno;i++){
- soma = soma + notas[i];
- media = soma / tamno;
- }
- printf ( "\nA média das notas é: %.2f\n", media);
- break;
- case 4 :
- for(i=0;i<tamno;i++){
- printf("Nota:\n");
- printf("%.2f\n", notas[i]);
- }
- break;
- case 5 :
- printf("\nVoce saiu do programa\n");
- break;
- default :
- printf("\nOpção invalida\n");
- break;
- }
- }while (numero !=5);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement