/* Sum Problem
Time Limit: 1000/500 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 399464 Accepted Submission(s): 100265
Problem Description
Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
Input
The input will consist of a series of integers n, one integer per line.
Output
For each case, output SUM(n) in one line, followed by a blank line. You may
assume the result will be in the range of 32-bit signed integer.
Sample Input
1
100
Sample Output
*/
#include<stdio.h>
int main(){
int i,num,sum;
while(scanf("%d",&num)!=EOF){
sum=0;
for(i=1;i<=num;++i)
sum+=i;
printf("%d\n\n",sum);
}
return 0;
}
Time Limit: 1000/500 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 399464 Accepted Submission(s): 100265
Problem Description
Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
Input
The input will consist of a series of integers n, one integer per line.
Output
For each case, output SUM(n) in one line, followed by a blank line. You may
assume the result will be in the range of 32-bit signed integer.
Sample Input
1
100
Sample Output
1
*/
#include<stdio.h>
int main(){
int i,num,sum;
while(scanf("%d",&num)!=EOF){
sum=0;
for(i=1;i<=num;++i)
sum+=i;
printf("%d\n\n",sum);
}
return 0;
}
//真的强调认真审题很重要 特别基础的题目 可是自己做了特别久,就是因为在复制题目的时候因为把输出的1和5050中间一行的给省略了,所以导致一直提示Presentation Error格式错误 真的很不应该
启示:在复制题目的时候应该全部保留 而不应该删除一些内容 很可能就是因为格式错误导致