I have a homework problem that I've almost finished, but I'm just stuck on how to output it correctly.

> 
> Write a program that reads a positive integer n and prints the sum of all integers from 1 to n as follows:
>  1+2+…+n=n(n+1)/2
>  The output does not contain any spaces.Example of input: 5 Corresponding output: 1+2+3+4+5=15
> 
> 
> 

Here's my code:

```
import java.util.Scanner;

public class Homework2 {
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int sum = 0;
    for (int i = 0;i <= n; i++) {
        sum = sum + i;
    }
    System.out.printf("the sum of %d is %d%n", n, sum);
 }
}

```

What I have in the printf command is just a placeholder until I can figure out the correct output.