#include<iostream.h> #include<conio.h> #define M 100 #define N 100 int nhap(int a[][N], int d, int c) { int i,j; for(i=0;i<d;i++) for(j=0;j<c;j++) { cout<<"a["<<i<<"]["<<j<<"]= "; cin>>a[i][j]; } } int xuat(int a[][N], int d, int c) { int i,j; for(i=0;i<d;i++) { for(j=0;j<c;j++) cout<<a[i][j]<<" "; cout<<endl; } }
int sochan(int a[][N],int d,int c) { cout<<endl<<"Kiem tra so toan chan: "<<endl; int i,j,s; for(i=0;i<d;i++) { for(j=0,s=0;j<c;j++) { cout<<a[i][j]<<" "; if(a[i][j]%2!=0||a[i][j]==0) s=-1; else s=s+1; } if(s==c) cout<<"Toan chan;"; else cout<<"ko"; cout<<endl;
} }
int main() { int a[M][N],d,c; cout<<"Nhap dong: ";cin>>d; cout<<"Nhap cot: ";cin>>c; nhap(a,d,c); xuat(a,d,c); sochan(a,d,c); getche(); }