void setup() {
size(100, 50);
background (255, 51, 102);
fill (51, 0, 0);
text ("G.C.D. is "+gcd(2, 8), 20, 30);
}
int gcd(int x, int y) {
if (x==0) {
return y;
}
if (y==0) {
return x;
}
if (x>y) {
return gcd(y, x%y);
}
else {
return gcd (x, y%x);
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น