C programming Writea fanction with the funcon prouype af int


C programming

Writea fanction with the funcon prouype af int cospaze int all. ins bl. int n) It will conpere vlues in twoan with slize Ihe comsponding values in cach element of the two aeays are the all the ame, the functon seturns 1.Otherwise, .Use the fintion you defined to compare two amays entered by the user, nd dipiny cier Two nys ane not the sameor Te arays are the sme Make sure that your test boh eses.

Solution

#include <stdio.h>

int main(void) {
int a[100],b[100],n,x,i;
printf(\"enter the array size\ \");
scanf(\"%d\",&n);
printf(\"ennter array A values %d\ \",n);
for(i=1;i<=n;i++)
{
scanf(\"%d\",&a[i]);
}
printf(\"ennter array B values %d\ \",n);
for(i=1;i<=n;i++)
{
scanf(\"%d\",&b[i]);
}
x=comper(a,b,n);
if(x==1)
printf(\"the two array values are same\");
else
printf(\"the two array elements are not same\");
return 0;
}

comper(int a[],int b[],int n)
{
int i,count=0;
for(i=1;i<=n;i++)
{
if(a[i]==b[i])
{
count++;
}
}
if(count==n)
return 1;
else
return 0;
}

 C programming Writea fanction with the funcon prouype af int cospaze int all. ins bl. int n) It will conpere vlues in twoan with slize Ihe comsponding values i

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site