File talk:Euclid flowchart.svg
Appearance
Is this supposed to result in an infinite loop whenever A=0?
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int a, b;
if (argc != 3) {
return EXIT_FAILURE;
}
a = atoi(argv[1]);
b = atoi(argv[2]);
while (b != 0) {
if (a > b) {
a = a - b;
} else {
b = b - a;
}
}
printf("%d\n", a);
return EXIT_SUCCESS;
}
Talk pages are where people discuss how to make content on Wikipedia the best that it can be. You can use this page to start a discussion with others about how to improve the "File:Euclid flowchart.svg" page.