Playground
Write AlgoML in your browser, see the generated code as you type and run it. No installation needed. We are building it.
gcd.aml
1Algorithm Gcd2version '1.0'3language C45function gcd(a : INT, b : INT) : INT6 variable r : INT7begin8 while b <> 0 do9 r <- a mod b10 a <- b11 b <- r12 end while13 return a14end function1516variable x : INT17variable y : INT1819begin20 read(x)21 read(y)22 write("gcd = ", gcd(x, y), "\n")23end24end algorithm
1#include <stdio.h>23int x;4int y;56int gcd(int a, int b);78int gcd(int a, int b) {9 int r;10 while (b != 0) {11 r = a % b;12 a = b;13 b = r;14 }15 return a;16}1718int main() {19 scanf("%d", &x);20 scanf("%d", &y);21 printf("gcd = %d\n", gcd(x, y));22 return 0;23}
Input
48 36Output gcd = 12Errors as you type
Mistakes are underlined with a clear message, like in VS Code.
Every language side by side
Switch between the generated files with one click.
Run and share
Run your program with your own input, then share it with a link.
In the meantime
Install the VS Code extension: it already checks your code as you type and generates it in one click.