-
Notifications
You must be signed in to change notification settings - Fork 0
/
pr17.c
33 lines (30 loc) · 768 Bytes
/
pr17.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*To check 2 Arrays are equal or not?*/
#include<stdio.h>
void main(){
int arr1[3]={10,20,30};
int arr2[3]={10,25,35};
printf("Array1:");
for(int i=0;i<3;i++){
printf("|%d|",arr1[i]);
}
printf("\n");
int flag=0;
printf("array2:");
for(int i=0;i<3;i++){
printf("|%d|",arr2[i]);
}
printf("\n");
for(int i=0;i<3;i++){
if(arr1[i]==arr2[i]){
flag=1;
}
else{
flag=0;
}
}
if(flag==1){
printf("array is equal\n");
} else{
printf("not equal\n");
}
}