Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
GCD
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//Title of this code //V8 3.31.1 function gcd(a,b) { var greatest_divisor = 1; var divisor = 2; if (a<2 || b<2) print(greatest_divisor); else if (a<0 || b<0) print("error"); else { while (a>=divisor && b>=divisor) { if (a%divisor==0 && b%divisor==0) { greatest_divisor = divisor; } divisor++; } print(greatest_divisor); } } gcd(33,55);
[
+
]
Show input
Absolute running time: 0.16 sec, cpu time: 0.01 sec, memory peak: 9 Mb, absolute service time: 0.17 sec
edit mode
|
history
|
discussion
11