Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define N 15
- struct notas{
- char nombre[50];
- float nota;
- };
- struct notas n[N];
- int main(){
- float max = 0, min = 10;
- char nombre1[50];
- char nombre2[50];
- for (int i = 0; i < N; i++){
- printf("Nombre alumno: ");
- gets(n[i].nombre);
- printf("Nota: ");
- scanf("%f",&n[i].nota);
- while(getchar()!= '\n');
- }
- for(int i = 0; i < N; i++){
- if (n[i].nota < min){
- min = n[i].nota;
- strcpy(nombre1,n[i].nombre);
- }
- if (n[i].nota > max){
- max = n[i].nota;
- strcpy(nombre2,n[i].nombre);
- }
- }
- printf("\nEl alumno %s tiene la nota más alta que es %f\n",nombre2,max);
- printf("El alumno %s tiene la nota más baja que es %f\n",nombre1,min);
- for (int i = 0; i < N ; i++){
- printf("Alumno:%s\tNota:%f\n",n[i].nombre,n[i].nota);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment