#include <iostream>using namespace std; int main() { // your code goes herecout<<foo(12,4); return 0;}unsigned foo(unsigned x, unsigned y){while(true){x=(x>y)?x%y:x;y=(x>y)?y:y%x;if(x==0) return y;if(y==0) return x;}}
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:6:7: error: ‘foo’ was not declared in this scope cout<<foo(12,4); ^~~ prog.cpp:6:7: note: suggested alternative: ‘feof’ cout<<foo(12,4); ^~~ feof
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!