Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<stdio.h>
- int main(void)
- {
- int idade, menor_idade, maior_idade, dif_idade, por_pessimo, acc_o,acc_r;
- int i;
- int c;
- int op;
- float media_ruim;
- float me_i_ruim;
- float dif_por_b_re;
- acc_o = 0;
- acc_r = 0;
- maior_idade = 0;
- menor_idade = 0;
- int acc_b = 0;
- int acc_re = 0;
- int acc_p = 0;
- int acc_i_r = 0;
- for (c=1;c<=3;c++)
- {
- printf ("Informe a idade:");
- scanf ("%d",&idade);
- printf("Escolha uma opcao: 1 - Otimo, 2 - Bom, 3 -Regular, 4 - Ruim ou 5 - Pessimo");
- scanf("%d",&op);
- if (idade > maior_idade)
- maior_idade = idade;
- if (idade < menor_idade)
- menor_idade = idade;
- switch (op) {
- case 1: acc_o++;break;
- case 2: acc_b++; break;
- case 3: acc_re++; break;
- case 4: acc_r++; acc_i_r = acc_i_r + idade; break;
- case 5: acc_p++; break;
- }
- }
- media_ruim = acc_i_r / acc_r;
- dif_por_b_re = (acc_b - acc_re) / 100;
- por_pessimo = (acc_p / 100);
- printf("A quantidade de respostas otimo eh %d\n",acc_o);
- printf("A diferenca percentual entre respostas bom e regular eh: %f\n",dif_por_b_re);
- printf("A media das pessoas que responderam ruim eh %f\n",media_ruim);
- //printf("A porcentagem de respostas pessimo eh %f a maior idade que utilizou esta opcao eh: %d\n",por_pessimo,maior);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement