You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write a program to pass 2 int values to a function such that the first number is lower than the second number. The integer values will be the range and the function returns the sum of the numbers in the range.
1/3/24 */
importjava.util.Scanner;
publicclassProgram39 {
publicstaticvoidmain(Stringargs[]) {
Scannersc = newScanner(System.in);
System.out.print("Enter lower number: ");
intl = sc.nextInt();
System.out.print("Enter higher number: ");
intu = sc.nextInt();
if (l > u) {
System.out.println("Lower number should be less than the higher number.");