Skip to content

Instantly share code, notes, and snippets.

@mb6ockatf
Last active February 4, 2024 17:34
Show Gist options
  • Save mb6ockatf/55749c59a787e648f36e04bb5ef6d098 to your computer and use it in GitHub Desktop.
Save mb6ockatf/55749c59a787e648f36e04bb5ef6d098 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void);
int main(void){
int m, n;
int r = 1;
scanf("%d", &m);
scanf("%d", &n);
if (m < n) {
m = m - n;
n = m + n;
m = n - m;
}
r = m % n;
while (r != 0){
r = m % n;
m = n;
n = r;
}
printf("%d", n);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment