[Solved] I don’t find the error


try this correction to your program

#include <stdio.h>
#include <stdlib.h>

/*
 * 
 */
#define NB_MESURES  50

int main(int argc, char** argv) {
    int i=0;
    float measure[NB_MESURES] /* NB_MESURES is predefined to be 50*/
   ,sum=0,average=0;
    char sex=0;
    char yn=0;


    while(1){ /*endless loop (1)*/

            printf("Persoa %d",i);
            printf("\nIndique se é home (H) ou muller (M): ");


            while(1) /*endless loop (level 2)*/
            {
                scanf(" %c",&sex);
                if((sex == 'M') || (sex == 'H')) break; /*Upper case*/
                if((sex == 'm') || (sex == 'h')) break; /*Lower case*/

                /* ok exit loop (level 2)
                   else show the help message */
                printf("Lo ha escrito mal.");
                printf("\nIndique se é home (H) ou muller (M): ");  
            }

            printf("Indique a súa measure (en metros): ");
            scanf("%f",&measure[i]);

            sum=sum+measure[i];
            i++; 
            if(i==NB_MESURES){
                  /* 
                    we can not add more than 50 elements
                    exiting loop (1)
                  */
                printf("\nMax Allowed entries is %d\n",NB_MESURES);
                break;
            }else{
                printf("\nDesea seguir? (Y/N): ");
                while(1) /* loop (level 2) */
                {
                    scanf(" %c",&yn);
                    if((yn == 'Y') || (yn == 'N')) break;
                    if((yn == 'y') || (yn == 'n')) break; 
                    /* if the input was different than ['Y','y','N','n']
                       show newt message else we break and use yn in the next check to exit loop (level 1)
                    */
                    printf("Lo ha escrito mal.");
                    printf("\nDesea seguir? (Y/N): "); 
                }

                if((yn == 'N') || (yn == 'n')) break; /*Exit level 1*/
            }
    }

    average=sum/i;
    printf("\nA media de measures é: %f m.\n",average);    

    return (EXIT_SUCCESS);
}

2

solved I don’t find the error