Created
April 25, 2018 12:46
-
-
Save SametSahin10/1e356f7cfa39c099dd3fb5b2aec5c569 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
int n; | |
printf("Enter the number of x and y values: \n"); | |
scanf("%d", &n); | |
int arrayOfX[n]; | |
int arrayOfY[n]; | |
printf("Enter the indicies of arrayOfX\n"); | |
for(int i = 0; i < n; i++) { | |
scanf("%d", &arrayOfX[i]); | |
} | |
printf("\n"); | |
printf("Enter the indicies of arrayOfY\n"); | |
for(int i = 0; i < n; i++) { | |
scanf("%d", &arrayOfY[i]); | |
} | |
printf("\n"); | |
for(int i = 0; i < n; i++) { | |
for(int j = 0; j < n; j++) { | |
if (arrayOfX[i] == arrayOfY[j]) { | |
printf("arrayOfX's %d.element is: %d\n", i + 1, arrayOfX[i]); | |
printf("arrayOfY's %d.element is: %d\n", j + 1, arrayOfY[j]); | |
printf("Difference between indicies is %d\n", abs(i - j)); | |
printf("\n"); | |
} | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment