Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading the number series without using a loop #27

Open
akshit-bhatt opened this issue Oct 12, 2020 · 1 comment
Open

Reading the number series without using a loop #27

akshit-bhatt opened this issue Oct 12, 2020 · 1 comment

Comments

@akshit-bhatt
Copy link

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)

@ShubhamPalriwala
Copy link
Member

Hey, looks good !
Please make a PR !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants