write an algorithm to print numbers from 1 to 100 in reverse order ?
( answer in steps )
Answers
Answered by
0
Answer:
def revernum():
num = reversed(range(101))
print(num)
Explanation:
I'm writing this answer in python.
1. declare a function
2. Inside the func. create a variable
3. python have a inbuilt function to reverse the numbers ( known as reversed() )
4. wrap the range function ( which is used to print numbers ) inside the reversed() function.
5. inside the range function , type in the desired number (in our case its 101)
I'm writing 101 bcoz range excludes the given number. For eg. if u type in:
print(range(100)), it'll only print till 99. That's why we are using the number 101.
Mark me as the brainliest!
Similar questions