Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define WIDTH 50
- int EuclidGCD(int A, int B);
- int main()
- {
- int a[WIDTH][WIDTH];
- int i,j;
- for (i = 0; i < WIDTH; i++)
- {
- for (j = 0; j < WIDTH; j++)
- {
- if (EuclidGCD(i,j) == 1)
- a[i][j] = 1;
- else
- a[i][j] = 0;
- }
- }
- int x,y;
- for (y = 0; y < WIDTH; y++)
- {
- for (x = 0; x < WIDTH; x++)
- printf("%d, ", a[x][y]);
- printf("\n");
- }
- return 0;
- }
- int EuclidGCD(int A, int B)
- {
- if (A + B == A || A + B == B) return A + B;
- while (A != B)
- {
- if (B > A)
- {
- int Temp = A;
- A = B;
- B = Temp;
- }
- A = A - B;
- }
- return A;
- }
Advertisement
Add Comment
Please, Sign In to add comment