Skip to content

Instantly share code, notes, and snippets.

@ghost355
Last active November 9, 2024 05:15
Show Gist options
  • Save ghost355/f11dcaebcc0f21c39dad0087dcc35d0b to your computer and use it in GitHub Desktop.
Save ghost355/f11dcaebcc0f21c39dad0087dcc35d0b to your computer and use it in GitHub Desktop.

Revisions

  1. ghost355 revised this gist Nov 9, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nod.c
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    #include<stdlib.h>
    int nod(int x, int y) {
    int a = abs(X);
    int a = abs(x);
    int b = abs(y);

    if (b > a) {
  2. ghost355 revised this gist Nov 9, 2024. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions nod.c
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,12 @@
    int nod(int x, int y) {
    int a = abs(X);
    int b = abs(y);

    if (b > a) {
    int temp = b;
    a = b;
    b = temp;
    }

    return b==0 ? a : nod(b, a%b);
    }
  3. ghost355 revised this gist Nov 9, 2024. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions nod.c
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    int nod(int a, int b) {
    a = mod(a);
    b = mod(b);
    #include<stdlib.h>
    int nod(int x, int y) {
    int a = abs(X);
    int b = abs(y);
    if (b > a) {
    int temp = b;
    a = b;
  4. ghost355 revised this gist Nov 9, 2024. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions nod.c
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    int nod(int a, int b) {
    a = mod(a);
    b = mod(b);
    if (b > a) {
    int temp = b;
    a = b;
  5. ghost355 revised this gist Nov 9, 2024. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion nod.c
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,8 @@
    int nod(int a, int b) {
    return b==0 ? a : nod(b, a%b);
    if (b > a) {
    int temp = b;
    a = b;
    b = temp;
    }
    return b==0 ? a : nod(b, a%b);
    }
  6. ghost355 created this gist Nov 9, 2024.
    3 changes: 3 additions & 0 deletions nod.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    int nod(int a, int b) {
    return b==0 ? a : nod(b, a%b);
    }