This piece of code came out of a challenge to write a euclid solving tool in C in as few source code bytes as possible.
It has been tested as compiling on gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
main(a,b,c){for(scanf("%d%d",&a,&b);c=a%b;a=b,b=c);return b;} |
echo 'main(a,b,c){for(scanf("%d%d",&a,&b);c=a%b;a=b,b=c);return b;}' | gcc -o euclid -x c - | |
echo '7 21' | ./euclid; test $? -eq 7 && echo "PASS" || echo "FAIL" |