Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Have an account? Sign In

Captcha Click on image to update the captcha.

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Tech Answered Logo Tech Answered Logo
Sign InSign Up

Tech Answered

Tech Answered Navigation

  • Home
  • Tutorials
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Blog
  • Contact Us
Home / Questions /Q 2936
Next
In Process
Ramya
Ramya

Ramya

  • India
  • 2 Questions
  • 1 Answer
  • 0 Best Answers
  • 2 Points
View Profile
  • 0
Ramya
Asked: September 16, 20212021-09-16T09:03:57+05:30 2021-09-16T09:03:57+05:30In: Python

Write a program to print integers from N to 1.

  • 0

I got stuck in this problem. when the user enters the input number that is “N”. So I need to print the integers from N to 1. How to solve this problem in python? Explain in detail?

For suppose,

Test case:

input:    5

output:  5 4 3 2 1

 

how to print integers from n to 1 in pythonwrite a program to print integers from n to 1 in pythonwrite a program to print nth number in python?write a program to print numbers from n to 1 in python?
  • 1
  • 971
  • 0
  • 0
Answer
Share
  • Facebook

    Related Questions

    • What is the difference between modules and packages in Python?
    • how to remove indentation error in python
    • what is the difference between list and tuple in python
    • Python Program To Print Stars (*) In Different Patterns?
    • What Is The Python Program To Print The Calendar Of A Particular Month?
    • Write A Python Program To Accept A File Name From The User And Print The Extension Of The File Name.
    • Python Program To Count The Number Of Vowels In A Sentence?

    1 Answer

    1. deepika

      deepika

      • India
      • 1 Question
      • 1 Answer
      • 0 Best Answers
      • 23 Points
      View Profile
      deepika
      2021-09-21T16:11:49+05:30Added an answer on September 21, 2021 at 4:11 pm

      To Write a program to print integers from N to 1, we use a loop in python.

      let us store input value in a variable “n”,  Now when  user enters any number then that number gets stored into variable “n”.

      We use for loop in range(n), we are using range(n) because we want a series of numbers.

      To get number series from 1 to 5 we store this values in variable k.

      now we can get the series that we required.

      Required code is this:

      n=int(input())

      for i  in range(n):

      k=(n-i)

      print(k)

      • 1
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    More Questions

    • Himasree

      What is the difference between modules and packages in Python?

    • Swathi

      how to remove indentation error in python

    • Swathi

      what is the difference between list and tuple in python

    • Vipinkv

      Python Program To Print Stars (*) In Different Patterns?

    • Vipinkv

      What Is The Python Program To Print The Calendar Of

    • Krishna Vijayan

      Write A Python Program To Accept A File Name From

    • Vipinkv

      Python Program To Count The Number Of Vowels In A

    • arunraj503

      Addition of two numbers in Python using user input example

    Stats

    • Questions 1,992
    • Answers 2,102
    • Posts 12
    • Best Answers 73

    Related Questions

    • Himasree

      What is the difference between modules and packages in Python?

    • Swathi

      how to remove indentation error in python

    • Swathi

      what is the difference between list and tuple in python

    • Vipinkv

      Python Program To Print Stars (*) In Different Patterns?

    • Vipinkv

      What Is The Python Program To Print The Calendar Of A Particular

    • Krishna Vijayan

      Write A Python Program To Accept A File Name From The User

    • Vipinkv

      Python Program To Count The Number Of Vowels In A Sentence?

    • arunraj503

      Addition of two numbers in Python using user input example program

    Explore

    • Home
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help

    Footer

    Recent Comments

    • muller on how to solve export problem in kinemaster
    • muller on how to solve export problem in kinemaster
    • muller on how to solve export problem in kinemaster
    • AaronBlackburn on why can’t i find my message requests on instagram
    • shree on How to use philips citrus press juicer 25 watts Demo
    Ask A Question

    Archives

    Tags

    laptop buying guide (1) limit google news notifications (1) printer buying guide (1) stop google news notifications (1) turn off google news notifications (1)

    Social media

    © 2023 @ Techanswered.com.
    Terms, Privacy policy & Sitemap.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.