Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //IFF - Introdução à Programação
- //Slide - Página 32 - Exercício 3
- #include<stdio.h>
- #include<locale.h>
- #include<string.h>
- int main(){
- setlocale(LC_ALL,"Portuguese");
- char sexo[10];
- int n, i, homens, mulheres;
- homens=mulheres=0;
- printf("Entre com a quantidade de pessoas: ");
- scanf(" %d",&n);
- for(i=0;i<n;i++){
- printf("Entre com o sexo da pessoa: ");
- scanf(" %s",&sexo);
- if (stricmp(sexo,"masculino")==0) homens++;
- if (stricmp(sexo,"feminino")==0) mulheres++;
- }
- printf("São %d homens e %d mulheres.",homens,mulheres);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement