//Ler:
//nome OK
//sexo OK
//três notas de cada aluno de uma turma OK
//flag nome=’f’ OK
//imprimir:
//média das mulheres OK
//nome da mulher com a menor média
//percentual de mulheres aprovadas
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void main (){
char nome, sexo;
float nota, notah, notam=0, media1, mediah=0, mediam=0, rh=0, rm=0, soma=0, somam=0, somah=0;
while(nome!='f'){
printf("Digite o nome do aluno: ");
scanf("%c", &nome);
fflush(stdin);
if(nome=='f'){
system("cls");
printf("voce saiu.\nA media das notas das mulheres foi: %.2f\n", mediam);
system("pause");
}
else{
printf("Se esse aluno e homem digite h, se e mulher digite m: ");
scanf("%c", &sexo);
fflush(stdin);
if(sexo=='m'){
rm++;
for(int i=0; i<=2; i++){
printf("Digite a nota desse aluno: ");
scanf("%f", ¬am);
fflush(stdin);
somam=somam+notam;
}
media1=(somam/3);
printf("A media desse aluno e: %.2f.\n", media1);
}
}
}
mediam=(somam/rm);
printf("\n\n");
system ("pause");
}
O codigo esta somando a media atual com a media anterior