You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def ShowNumber(N, Original, K, flag):
#To print the number
print(N, end = " ")
# change flag if the number becomes negative
if (N <= 0):
if(flag==0):
flag = 1
else:
flag = 0
# base condition for second_case (Adding K)
if (N == Original and (not(flag))):
return
# if flag == true, we subtract value until the number is greater then zero
if (flag == True):
ShowNumber(N - K, Original, K, flag)
return
# second case (Addition )
if (not(flag)):
ShowNumber(N + K, Original, K, flag);
return
N = 20
K = 6
ShowNumber(N, N, K, True)
The text was updated successfully, but these errors were encountered:
def ShowNumber(N, Original, K, flag):
#To print the number
print(N, end = " ")
# change flag if the number becomes negative
N = 20
K = 6
ShowNumber(N, N, K, True)
The text was updated successfully, but these errors were encountered: