hdu 1001 Sum Problem

#include<stdio.h>
int main(void)
{

    int
n;
    while
(scanf("%d",&n)!=EOF)
    if
(n%2)
        printf("%d\n\n",(n+1)/2*n);
    else
printf("%d\n\n",n/2*(n+1));
    return
0;
}

posted @ 2013-09-11 19:10  heaventouch  阅读(94)  评论(0编辑  收藏  举报