Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- int main()
- {
- double M[12][12], total = 0;
- int i = 0, j = 0, y;
- char x;
- scanf("%d %c", &y, &x);
- while(1){
- scanf("%lf", &M[i][j]);
- ++j;
- if (j == 12){
- ++i;
- j = 0;
- }
- if(i == 11 && j == 11)
- break;
- }
- j = 0;
- if(x == 'S'){
- i = y;
- while(j > 12){
- total = total + M[i][j];
- j++;
- }
- printf("%.1lf\n", total);
- }else if(x == 'M'){
- while(j > 12){
- total = total + M[i][j];
- j++;
- }
- total = total/12;
- printf("%.1lf\n", total);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement