print "Welcome to Dylan's Pythagorean Theorem Solver."
from math import sqrt
print "What are we solving for? A hypotenuse or a leg?"
ask = raw_input("# ")
if ask == "hypotenuse":
print "W
我的代碼有什麼問題?它打印2,2時,正確的答案顯然是6,8 public static void main(String[] args) {
int a = 1;
int b = 1;
int answer = 0;
int j = 4;
while (j == 4) {
for (a = 1; a <= 10; a++) {
我有這樣的代碼,使用一個上限變量N是應該終止X和勾股數組Y的。然而它只有在達到上限時纔會凍結。不知道如何使用剪切來停止回溯。代碼是: is_int(0).
is_int(X) :- is_int(Y), X is Y+1.
minus(S,S,0).
minus(S,D1,D2) :- S>0, S1 is S-1, minus(S1,D1,D3), D2 is D3+1.
pythag