hdu1001 Sum Problem(C语言)
来源:互联网 发布:exo同款内裤淘宝 编辑:程序博客网 时间:2024/03/29 02:16
Problem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
InputThe input will consist of a series of integers n, one integer per line.
OutputFor 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 Input1100
Sample Output15050
AuthorDOOM III
C语言AC代码
#include<stdio.h>int main(){ int n,i,sum=0; while(scanf("%d",&n)!=EOF) { for(i=1;i<=n;i++) sum=sum+i; printf("%d\n\n",sum); sum=0; } return 0;}
In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
1100
15050
#include<stdio.h>int main(){int n,i,sum=0;while(scanf("%d",&n)!=EOF){for(i=1;i<=n;i++)sum=sum+i;printf("%d\n\n",sum);sum=0;}return 0;}
阅读全文
0 0
- hdu1001 Sum Problem(C语言)
- HDU1001 Sum Problem
- hdu1001 Sum Problem
- hdu1001 - Sum Problem
- HDU1001 Sum Problem
- HDU1001 Sum Problem
- HDU1001 Sum Problem【水题】
- HDU1001——Sum Problem
- hdu1001 Sum Problem (等差数列求和)
- (解题报告)HDU1001---Sum problem
- hdu2058 The sum problem(C语言)
- HDU1001
- hdu1001
- HDU1001
- hdu1001
- HDU1001
- HDU1001
- hdu1001
- 行内元素和块级元素的区别
- python面向对象的编程思想0725
- JQuery
- 编写Shell脚本的最佳实践
- 【JAVA300】16-20 笔记
- hdu1001 Sum Problem(C语言)
- help VS man VS info
- 合并两链表
- 数据类型转换之 QString与binary
- 不放过任何一个获客机会 自助餐如何做好小程序?
- HDU 4311 Meeting point-1 (思维)
- 读取和保存txt文件
- SDWebImage如何避免复用
- linux grep命令使用详解