(adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-2960223314593660", enable_page_level_ads: true }); Python program to print natural numbers between n to 1. - TecGlance

Header Ads

Python program to print natural numbers between n to 1.

Algorithm:::



Step 1: Start
Step 2: Read a number, num
Step 3: Repeat step until 4&5 num=0 reaches
Step 4: Print num
Step 5: Compute num=num-1
Step 6: Stop

Flowchart:::


Program code:::

num=int(input('Enter a number '))
while num>0:
    print num
    num=num-1

No comments

Powered by Blogger.