C:
#include <stdio.h>
int main()
{
long long i,sum;
scanf("%I64d",&i);
sum=(i+1)*i/2;
printf("%I64d",sum);
return 0;
}
Java:
import java.util.Scanner;public class Main{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
long S;
while(in.hasNext())
{
S=in.nextLong();
System.out.println(S*(S+1)/2);
}
in.close();
}
}