write a for loop to display first 10 even numbers in revese order
Answers
Answer:
this is ur answer ☺️
Explanation:
Python Program to Print Natural Numbers in Reverse Order using While Loop
This Python program allows users to enter any integer value. Next, it prints natural numbers from the user-specified value to 1 using a while loop.
# Python Program to Print Natural Numbers in Reverse Order
number = int(input("Please Enter any Number: "))
i = number
print("List of Natural Numbers from {0} to 1 in Reverse Order : ".format(number))
while ( i >= 1):
print (i, end = ' ')
i = i - 1
OUTPUT
Python Program to Print Natural Numbers in Reverse Order 1
Python Program to Reverse Order Natural Numbers Example 2
This Python program is the same as the first example. However, this Python program allow the user to enter the minimum and maximum values. It means this program uses while loop to print natural numbers from maximum to a minimum.
Java:
public class ReverseEven {
public static void main(String[ ] args) {
for (int i = 20; i >= 2; i -= 2)
System.out.print(i + " ");
}
}
Python:
for i in range(20, 1, -2):
print(i, end = " ")