Skip to content

Instantly share code, notes, and snippets.

@KhaledElshamy
Created July 11, 2016 21:23
Show Gist options
  • Save KhaledElshamy/5154da0ebdc342eac590a672fc80352e to your computer and use it in GitHub Desktop.
Save KhaledElshamy/5154da0ebdc342eac590a672fc80352e to your computer and use it in GitHub Desktop.
URI ONLINE JUDGE Problem 1182
#include <stdio.h>
#define Num_column 12
#define Num_row 12
int main()
{
//URI ONLINE JUDGE Problem 1182
double b[Num_row][Num_column], (*p)[Num_column],sum = 0.0;
int i, j,a;
char c;
scanf("%d %c", &a,&c);
for (i = 0;i < 12;i++)
{
for (j = 0;j < 12;j++)
{
scanf("%lf", &b[i][j]);
}
}
for (p=&b[0];p<&b[Num_row] ;p++)
{
sum += (*p)[a];
}
if (c == 's')
printf("%.1lf\n", sum);
else
printf("%.1lf\n", sum / 12);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment