I am trying to show me "average age","minor","retired(60 years old)","older age" and "younger age.
but the program somo shows you the average age and the others are left blank, could you help me solve this problem please.
#include<stdio.h>
int main() {
int edad, totalmenores=0, totaljubilados=0, edadmenor, edadmayor=0, suma = 0, c = 0;
float media;
printf("\nIngrese la edad de la persona: ");
scanf("%d",&edad);
edadmenor = edad;
while (edad > 0) {
suma = suma + edad;
c ++;
if (edad<=17)
totalmenores=totalmenores+1;
if (edad>=60)
totaljubilados=totaljubilados+1;
if (edad > edadmayor)
edadmayor = edad;
if (edad <edadmenor)
edadmenor = edad;
printf("\nIngrese la edad de la persona: ");
scanf("%d",&edad);
}
media = suma / c;
printf("\nProemdio de edades: %.1f" , media);
printf("\nEdad mayor: %.1f" ,edadmayor);
printf("\nEdad menor: %.1f" ,edadmenor);
printf("\nTotal de jubilados: %.1f" ,totaljubilados);
printf("\nTotal de menores de edad: %.1f" ,totalmenores);
return 0;
}