C/Visual C - AYUDA DE C++ A PSEINT

 
Vista:

AYUDA DE C++ A PSEINT

Publicado por hoal (1 intervención) el 30/01/2023 21:35:12
Pasar este codigo a pseint

int main() {
int votosCandidato[5] = {0, 0, 0, 0, 0};
int T = 0;
int voto;

printf("\nIngrese los votos (0 para finalizar): ");
scanf("%d", &voto);
while (voto <> 0) {
votosCandidato[voto - 1]++;
T++;
scanf("%d", &voto);
}

for (int i = 0; i < 5; i++) {
float porcentaje = (float) votosCandidato[i] / T * 100;
printf("Candidato %d: %d votos (%f %%)\n", i+1, votosCandidato[i], porcentaje);
}
return 0;
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder