[HDOJ]1001. Sum Problem

简单的求和问题,只需要看好题目中的格式要求即可,否则会出现presentation error的错误提示。
Code:

#include <iostream>
using namespace std;
int main()
{
    
int n,sum;
    
while(cin>>n)
    {
        sum 
= 0;
        
for(int i = 1;i <= n;++i)
            sum 
+= i;
        cout
<<sum<<endl<<endl;
    }
    
return 0;
}

 

posted on 2009-04-05 22:52  笔记  阅读(985)  评论(0编辑  收藏  举报

导航