Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX 50
- #define maxwords 30
- int main()
- {
- int i,sum = 0,people,ages[MAX];
- char names[MAX][maxwords];
- printf("Entre com a quantidade de pessoas :\n");
- scanf("%d",&people);
- for (i = 0; i < people; i++) {
- printf("Entre com o nome :\n");
- fflush(stdin);
- gets(names[i]);
- printf("Entre com a idade :\n");
- scanf("%d",&ages[i]);
- sum = sum + ages[i];
- }
- for (i = 0; i < people; i++)
- {
- if (ages[i] > (float)sum/(float)people)
- printf("%s\n",names[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment