Advertisement
diogoAlves

IFF/Introdução à Programação/Slide/Pag 32/Ex 3

Feb 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. //IFF - Introdução à Programação
  2. //Slide - Página 32 - Exercício 3
  3. #include<stdio.h>
  4. #include<locale.h>
  5. #include<string.h>
  6.  
  7. int main(){
  8.     setlocale(LC_ALL,"Portuguese");
  9.     char sexo[10];
  10.     int n, i, homens, mulheres;
  11.     homens=mulheres=0;
  12.     printf("Entre com a quantidade de pessoas: ");
  13.     scanf(" %d",&n);
  14.     for(i=0;i<n;i++){
  15.         printf("Entre com o sexo da pessoa: ");
  16.         scanf(" %s",&sexo);
  17.         if (stricmp(sexo,"masculino")==0) homens++;
  18.         if (stricmp(sexo,"feminino")==0) mulheres++;
  19.     }
  20.     printf("São %d homens e %d mulheres.",homens,mulheres);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement