Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. int main()
  4. {
  5. double M[12][12], total = 0;
  6. int i = 0, j = 0, y;
  7. char x;
  8. scanf("%d %c", &y, &x);
  9. while(1){
  10. scanf("%lf", &M[i][j]);
  11. ++j;
  12. if (j == 12){
  13. ++i;
  14. j = 0;
  15. }
  16. if(i == 11 && j == 11)
  17. break;
  18. }
  19. j = 0;
  20. if(x == 'S'){
  21. i = y;
  22. while(j > 12){
  23. total = total + M[i][j];
  24. j++;
  25. }
  26. printf("%.1lf\n", total);
  27. }else if(x == 'M'){
  28. while(j > 12){
  29. total = total + M[i][j];
  30. j++;
  31. }
  32. total = total/12;
  33. printf("%.1lf\n", total);
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement