Problem Statement
Scan two metrics from user the
check weather two metrics are equal or not
#include<stdio.h>#define max 4
int cheak(int a[][max],int b[][max],int m,int n);
int main()
{
int a[max][max],b[max][max],i,j,k,l,n,m,y;
printf("enter the dimention of metrics one \n (first row then colm ) \n");
scanf("%d %d",&m,&n);
printf("enter the metrics of dimention %d*%d \n",m,n);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter the dimention of metrics two \n (first row then colm) \n");
scanf("%d %d",&k,&l);
printf("enter the metrics of dimention %d*%d \n",k,l);
for(i=0;i<k;i++)
{
for(j=0;j<l;j++)
{
scanf("%d",&b[i][j]);
}
}
if(m==k&&n==l)
{
y=cheak(a,b,m,n);
if(y==1)
{
printf("metrics are equal \n");
}
else
{
printf("metrics are unequal \n");
}
}
else
{
printf("metrics are unequal");
}
return 0;
}
int cheak(int a[][max],int b[][max],int m,int n)
{
int i,j;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(a[i][j]!=b[i][j])
{
return 0;
}
}
}
return 1;
}
No comments:
Post a Comment