Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int Promedio;
- char Nombre[2][256]; // Nombre[0] es el nombre y Nombre[1] es el apellido
- void CargarAlumno();
- void VerAlumno();
- int main(int argc, char *argv) {
- int Opcion = 1;
- do {
- printf("1. Cargar alumno\n");
- printf("2. Ver alumno\n");
- printf("0. Salir\n");
- printf("\nIngrese una opcion: ");
- scanf("%i", &Opcion);
- system("cls");
- switch(Opcion) {
- case 1:
- CargarAlumno();
- break;
- case 2:
- VerAlumno();
- break;
- }
- } while(Opcion != 0);
- return 1;
- }
- void CargarAlumno() {
- int CantidadDeNotas = 0;
- int SumaTotal = 0;
- printf("Ingrese el nombre del alumno: ");
- scanf("%s", Nombre[0]);
- printf("Ingrese el apellido del alumno: ");
- scanf("%s", Nombre[1]);
- printf("Ingrese 3 notas (del 1 al 10)");
- for(CantidadDeNotas = 0; CantidadDeNotas < 3; CantidadDeNotas++) {
- int Nota;
- scanf("%i", &Nota);
- SumaTotal += Nota;
- }
- Promedio = SumaTotal / 3;
- }
- void VerAlumno() {
- printf("Nombre: %s\tApellido: %s\tPromedio: %i", Nombre[0], Nombre[1], Promedio);
- }
Advertisement
Add Comment
Please, Sign In to add comment