Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int i,age,malecounter = 0,femalecounter = 0;
- char opt;
- for (i = 0; i < 5; ++i)
- {
- printf("Entre com o sexo : (m - homens / f - mulheres)\n");
- opt = getche();
- switch(opt)
- {
- case 'm':
- printf("\nEntre com a idade :\n");
- scanf("%d",&age);
- if (age>=18)
- {
- malecounter++;
- }
- break;
- case 'f':
- printf("\nEntre com a idade :\n");
- scanf("%d",&age);
- if (age>=18)
- {
- femalecounter++;
- }
- break;
- default:
- printf("Entrada invalida!\n");
- }
- }
- printf("%d homens e %d mulheres maiores de idade\n",malecounter,femalecounter);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment