It is be possible to print a number in reverse order :,, like you input 5 then it will give you response like this:"5,4,3,2,1"
If you want to apply this in python, then "copy" and "paste" the content given below πππ
FIRST METHOD
n = int(input("Enter Number:"))
print("Natural Numbers from" , n, "-1 in reverse")
while (n>=1):
print(n, end=" ")
print("Natural Numbers from" , n, "-1 in reverse")
while (n>=1):
print(n, end=" ")
n-=1
SECOND METHOD
n = int(input("Enter Number:"))
print("Natural Numbers from" , n, "-1 in reverse")
for i in range(n,0,-1):
print(i , end=" ")
Comments
Post a Comment