倒数第二个括号报错“缺少返回语句”怎么修改?
package mymath;
import java.util.Scanner;
public class MyMath {
public static double getSum(int n) {
int i,sum=0;
Scanner scan=new Scanner(System.in);
System.out.println("请输入正整数n:");
n=scan.nextInt();
for(i=1;i<=n;i++)
sum+=i;
System.out.printf("1到%d的累加结果:%d",i-1,sum);
}
}