Ctralvespinto 0 Posted January 8 Report Share Posted January 8 def fun (n, p): for i in range(p): print("---", end="") print("fun(%d,%d)" % (n, p)) if (n == 1): return 1 if (n % 2 == 0): return fun(n/2, p+1) return fun((n-1)/2, p+1) + fun((n+1)/2, p+1) Link to post Share on other sites
M6 150 Posted January 9 Report Share Posted January 9 Serve para ilustrar a recursividade? 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now