1006Sum Problem
来源:互联网 发布:淘宝店发货地址不能改 编辑:程序博客网 时间:2024/04/30 02:37
题目描述
Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
输入
The input will consist of a series of integers n, one integer per line.
输出
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.
示例输入
1100
示例输出
15050
#include<stdio.h>
int main(){
int i=0, n=0,sum =0;
while(scanf("%d",&n) != EOF)
{
sum = 0;
for (i =1;i<=n;i++)
sum+=i;
printf("%d\n", sum);
}
return 0;
}
- 1006 Sum Problem
- 1006Sum Problem
- SDUT 1006-->Sum Problem
- 1006 Sum Problem
- Sum Problem
- Sum Problem
- sum problem
- Sum Problem
- Sum Problem
- Sum Problem
- Sum Problem
- sum problem
- Sum Problem
- Sum Problem
- Sum Problem
- Sum Problem
- Sum Problem
- Sum Problem
- 1000. 链式哈希
- 透过SQL Server 2008访问Oracle 11g的配置方法
- SGU175-Encoding
- strlen、sizeof,sizeof(*)含义及区别
- 2014找工作总结-机会往往留给有准备的人
- 1006Sum Problem
- 2013.12.09
- Android 图片处理工具类封装
- spring配置文件详解--真的蛮详细
- 解读Makefile (1)
- 合作,向强者学习,成长
- Java之高精度
- leetcode_swap_nodes_in_pair
- JQuery历史版本