import java.util.Scanner;
public class sum{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
System.out.print("Enter n: ");
int n = scanner.nextInt();
System.out.print("Enter m: ");
int m = scanner.nextInt();
int sum = 0;
for(int i = 0; i<=n; i++){
for(int j = i+1; j<=n; j++){
sum = i * j;
}
}
System.out.print("Sum is: "+sum);
}
}
I'm not sure if this gives out the correct answer.