题解 | #小乐乐求和#
小乐乐求和
http://www.nowcoder.com/practice/ce0b2eacd3d04647831358c2876e44ff
import java.util.Scanner; import java.lang.String; public class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); long sum=0; for(int i=1;i<=n;i++) { sum=sum+i; } System.out.println(sum); } }