can anyone solve this java programming

Answers
Here is the Java Program which accomplishes the task. We take the inputs, run a loop in the given range. Then we check the divisibility of each number by 2 and add to the appropriate sum variables.
import java.util.Scanner;
public class Brainly
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter lower limit (m): ");
int m = sc.nextInt();
System.out.print("Enter upper limit (n): ");
int n = sc.nextInt();
if(n>m)
{
int sumOfOddNumbers = 0;
int sumOfEvenNumbers = 0;
for(int i=m;i<=n;i++)
{
if(i%2==0)
{
sumOfEvenNumbers += i;
}
else
{
sumOfOddNumbers += i;
}
}
System.out.println("Sum of Odd Numbers = "+sumOfOddNumbers);
System.out.println("Sum of Even Numbers = "+sumOfEvenNumbers);
}
else
{
System.out.println("Invalid Inputs.");
}
}
}

