Skip to content

Instantly share code, notes, and snippets.

@behitek
Last active November 28, 2017 03:55
Show Gist options
  • Save behitek/551f526edce149301a55e2f3d539bd40 to your computer and use it in GitHub Desktop.
Save behitek/551f526edce149301a55e2f3d539bd40 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(){
int m,n;
int a[100][100];
printf("\nNhap so hang, so cot: ");
scanf("%d%d", &m, &n);
// Nhap mang 2 chieu
for(int i = 0;i < m;i++){
for(int j = 0; j < n;j++){
printf("\nNhap a[%d][%d] = ", i, j);
scanf("%d",&a[i][j]);
}
}
for(int i = 0;i < m;i++){
for(int j = 0; j < n;j++){
printf("%d ",a[i][j]);
}
printf("\n");
}
}
#include<stdio.h>
int main()
{
int i,j,h;
long long tong;
int a[100][100];
scanf("%d",&h);
for(i=0;i<h;i++){
for(j=0;j<h;j++){
scanf("%d",&a[i][j]);
}
}
tong=0;
for(i=0;i<h;i++){
for(j=0;j<h;j++){
if(i%2==0 || j%2==0){
tong+=a[i][j];
}
}
}
printf("%ld",tong);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment