Advertisement
asiffff

Untitled

Jan 24th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int n,v=0;
  5. while(1)
  6. {
  7. scanf("%d",&n);
  8. if(n==0) { break; }
  9. else
  10. {
  11. while(n--)
  12. {
  13. char c[31];
  14. int a;
  15. scanf("%d %s",&a,&c);
  16. if(c[0] == 's') v+=(120*a);
  17. else if(c[0] == 'm' && c[8] == 'f') v+=85*a;
  18. else if(c[0] == 'm' && c[2] == 'm') v+=85*a;
  19. else if(c[0] == 'g') v+=70*a;
  20. else if(c[0] == 'm') v+=56*a;
  21. else if(c[0] == 'l') v+=50*a;
  22. else if(c[0] == 'b') v+=34*a;
  23. }
  24. }
  25. if(v<110) printf("Mais %d mg\n",110-v);
  26. else if(v>130) printf("Menos %d mg\n",v-130);
  27. else if(v>=110 && v<=130) printf("%d gm\n",v);
  28. v=0;
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement