In Python:---------------------------------------------------------------------------------------------------------------------- def main (): try: min_val = int(input("Enter min value: ")) max_val = int(input("Enter max value: ")) div_all_odd(min_val,max_val) except ValueError: print("Please Enter a Integer Value.") def div_all_odd (min_val, max_val): if (min_val < max_val or min_val == max_val): for i in range(min_val,(max_val+1)): if(i%2 != 0): print(i) else: print("\nThe min value is greater than the max value, this values will be swapped.\n") print(f"Min: {min_val} Max: {max_val} --> Min: {max_val} Max: {min_val}") #swap temp = min_val; min_val = max_val; max_val = temp; #print for i in range(min_val,(max_val+1)): if(i%2 != 0): print(i) main() In Java:------------------------------------------------------------------------------------------------------------------------ import java.util.InputMismatchException; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = 0; int b = 0; try { System.out.println("Enter min value: "); a = sc.nextInt(); System.out.println("Enter max value: "); b = sc.nextInt(); dis_all_odd(a, b); } catch (InputMismatchException e) { System.out.println("Please Enter a Integer Value!"); } } public static void dis_all_odd (int min_value, int max_value) { if(min_value "+"Min: "+max_value+" Max: "+min_value); //swap int temp = min_value; min_value = max_value; max_value = temp; //print for (int i=min_value; i<=max_value; i++) { if(i%2!=0) { System.out.println(i); } } } } } In C#:------------------------------------------------------------------------------------------------------------------------- using System; public class Program { public static void Main() { int a = 0; int b = 0; try{ Console.WriteLine("Enter min value: "); a = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter max value: "); b = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("\n"); dis_all_odd(a, b); } catch(FormatException){Console.WriteLine("Please Enter a Integer Value!");} } public static void dis_all_odd (int min_val, int max_val){ if(min_val < max_val || min_val == max_val) { //print for (int i=min_val; i<=max_val; i++) { if(i%2!=0) { Console.WriteLine(i); } } } else { Console.WriteLine("The min value is greater than the max value, this values will be swapped.\n"); Console.WriteLine("Min: {0} Max: {1} --> Min: {1} Max: {0}", min_val,max_val); //swap int temp = min_val; min_val = max_val; max_val = temp; //print for (int i=min_val; i<=max_val; i++) { if(i%2!=0) { Console.WriteLine(i); } } } } }