Let's use a for loop. We'll iterate through all the numbers from to in descending order and print the even ones.
Read the input data.
scanf("%d %d", &a, &b);Iterate through the numbers from to in descending order and print the even ones.
for (i = b; i >= a; i--)
if (i % 2 == 0)
printf("%d ", i);import java.util.*;
class Main
{
public static void main(String[] args)
{
Scanner con = new Scanner(System.in);
int a = con.nextInt();
int b = con.nextInt();
for(int i = b; i >= a; i--)
if (i % 2 == 0)
System.out.print(i + " ");
con.close();
}
}Read the input data.
a, b = map(int, input().split())Iterate through the numbers from to in descending order and print the even ones.
for i in range(b, a - 1, -1):
if i % 2 == 0:
print(i, end=" ")