0
int sexo = 1;
float altura;
int tm = 0, tf = 0, sm = 0, sf =0;
printf ("O valor 0 encera o programa !!!\n");
while (sexo!=0)
{
printf ("1-Masculino\t2-Feminino\n");
scanf ("%d", &sexo);
if (sexo == 1)
{tm++;
printf ("altura do Homen: \n");
scanf ("%f", &altura);}
if (sexo == 2)
{tf++;
printf ("Altura da Mulher: \n");
scanf ("%f", &altura);}
if (altura>0)
altura=maior;
{maior=altura}
}
printf ("Maior altura :%2.f",maior);
printf ("Numero total de Homens: %d", tm);
printf ("Numero total de Mulheres: %d", tf);
}
They were on it for hours
– Silva
to print the smallest would be if (height<smaller){smallest=height;} ?
– Silva
No... You would have to initially assign lower as the first received value in the first iteration. From the second iteration you could do
if (altura<menor){menor=altura;}
– João Pedro Henrique