The code needs to be in C #. You can define the upper and lower bounds.
Q. You are given a lower and an upper bound for a range of integer numbers. Write a program that prints the range of numbers in the reverse order and prints it back on the original order.
using System; public class Sequence { public static void Main(string[] args) { Console.Write("Enter upper bound: "); int upper = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter lower bound: "); int lower = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Reverse order: "); for (int i = upper; i >= lower; i--) { Console.WriteLine(i); } Console.WriteLine("Original order: "); for (int i = lower; i <= upper; i++) { Console.WriteLine(i); } } }
Get Answers For Free
Most questions answered within 1 hours.