Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <stdlib.h>
- #include <ctype.h>
- int main() {
- int qtd,i;
- char size;
- int quantidade_cap_p;
- int quantidade_cap_g;
- int total;
- int media;
- int total_p = 0;
- int total_g = 0;
- i = 0;
- total = 0;
- do
- {
- scanf("%d\n%c", &qtd,&size);
- size = tolower(size);
- switch (size)
- {
- case 'p':
- quantidade_cap_p = qtd * 10;
- total_p = total + quantidade_cap_p;
- total = total_p + total_g;
- break;
- case 'g':
- quantidade_cap_g = qtd * 16;
- total_g = total + quantidade_cap_g;
- total = total_p + total_g;
- break;
- /*default:
- i++;
- total = total_p + total_g;*/
- }
- i++;
- }
- while (i < 7);
- printf("%d", total);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement