2016:【例4.1】for循环求和

【题目描述】

利用for循环。计算输出1+2+3+...+n1+2+3+...+n的和。

【输入】

输入n。

【输出】

如题述,之和。

【输入样例】

10

【输出样例】

55

【提示】

【数据规模及约定】

对于100%的数据,1≤n≤100。

【解题代码】

#include<stdio.h>
int main()
{
	int i,n,sum=0;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		sum+=i;
	}
	printf("%d",sum);
	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
I 数学分析(Proofs) 简介(Introduction) 0.1 参考文献(References) 1 什么是证明?(What is a Proof?) 1.1 命题(Propositions) 1.2 谓词(Predicates) 1.3 公理化方法(The Axiomatic Method) 1.4 我们的公理(Our Axioms) 1.5 证明命题的含义(Proving an Implication) 1.6 证明「有且仅有」(Proving an「If and Only If」) 1.7 案证明(Proof by Cases) 1.8 反证法(Proof by Contradiction) 1.9 证明的实战演练(Good Proofs in Practice) 1.10 参考文献(References) 2 良序原则(The Well Ordering Principle) 2.1 良序证明(Well Ordering Proofs) 2.2 良序证明模式(Template for Well Ordering Proofs) 2.3 素数因子分解(Factoring into Primes) 2.4 良序集合(Well Ordered Sets) 3 逻辑公式(Logical Formulas) 3.1 命题中的命题(Propositions from Propositions) 3.2 计算机程序中的命题逻辑(Propositional Logic in Computer Programs) 3.3 等价性和有效性(Equivalence and Validity) 3.4 命题的代数(The Algebra of Propositions) 3.5 SAT 问题(The SAT Problem) 3.6 谓词公式(Predicate Formulas) 3.7 参考文献(References) 4 数学上的数据类型(Mathematical Data Types) 4.1 集合(Sets) 4.2 序列(Sequences) 4.3 函数(Functions) 4.4 二元关系(Binary Relations) 4.5 有限基数(Finite Cardinality) 5 简介(Induction) 5.1 一般归纳法(Ordinary Induction) 5.2 强归纳法(Strong Induction) 5.3 强归纳法、一般归纳法和良序法(Strong Induction vs. Induction vs. Well Ordering) 6 状态机(State Machines) 6.1 状态和转换(States and Transitions) 6.2 不变量原则(The Invariant Principle) 6.3 部分正确性和终止(Partial Correctness & Termination) 6.4 稳定婚姻问题(The Stable Marriage Problem) 7 递归数据型(Recursive Data Types) 7.1 递归定义和结构归纳法(Recursive Definitions and Structural Induction) 7.2 Matched Brackets 字符串(Strings of Matched Brackets) 7.3 非负整数递归函数(Recursive Functions on Nonnegative Integers) 7.4 算术表达式(Arithmetic Expressions) 7.5 递归数据型在计算机科学中的简介(Induction in Computer Science) 8 无限集(Infinite Sets) 8.1 无限基数集(Infinite Cardinality) 8.2 停止问题(The Halting Problem) 8.3 集合的逻辑(The Logic of Sets) 8.4 这些真的有效吗?(Does All This Really Work?) II 结构(Structures) Introduction 9 数论(Number Theory) 9.1 可分性(Divisibility) 9.2 最大公约数(The Greatest Common Divisor) 9.3 神秘的素数(PrimeMysteries) 9.4 算术的基本定理(The Fundamental Theorem of Arithmetic) 9.5 Alan Turing 9.6 模运算(Modular Arithmetic) 9.7 余数运算(Remainder Arithmetic) 9.8 Turing's Code (Version 2.0) 9.9 乘法逆运算和消除(Multiplicative Inverses and Cancelling) 9.10 欧拉定理(Euler's Theorem) 9.11 RSA 公钥加密(RSA Public Key Encryption) 9.12 SAT 与它有什么关系?(What has SAT got to do with it?) 9.13 参考文献(References) 10 有向图和部分排序(Directed graphs & Partial Orders) 10.1 顶点度(Vertex Degrees) 10.2 步长与路径(Walks and Paths) 10.3 临近矩阵(Adjacency Matrices) 10.4 Walk Relations 10.5 有向非循环图标和时序(Directed Acyclic Graphs & Scheduling) 10.6 局部排序(Partial Orders) 10.7 通过集合遏制表征局部排序(Representing Partial Orders by Set Containment) 10.8 线性排序(Linear Orders) 10.9 乘积排序(Product Orders) 10.10 等价关系(Equivalence Relations) 10.11 关系属性总结(Summary of Relational Properties) 11 通信网络(Communication Networks) 11.1 路由(Routing) 11.2 Routing Measures) 11.3 网络设计(Network Designs) 12 简单图(Simple Graphs) 12.1 Vertex Adjacency and Degrees) 12.2 美国性别人口统计(Sexual Demographics in America) 12.3 一些常见的图(Some Common Graphs) 12.4 同构(Isomorphism) 12.5 二部图&匹配(Bipartite Graphs & Matchings) 12.6 Coloring 12.7 Simple Walks 12.8 连接(Connectivity) 12.9 森林和树(Forests & Trees) 12.10 References 13 平面图(Planar Graphs) 13.1 在平面中绘制图(Drawing Graphs in the Plane) 13.2 平面图的定义(Definitions of Planar Graphs) 13.3 欧拉公式(Euler's Formula) 13.4 在平面图中限定边的数量(Bounding the Number of Edges in a Planar Graph) 13.5 Returning to K5 and K3;3 13.6 Coloring Planar Graphs 13.7 Classifying Polyhedra 13.8 平面图的另一种特征化(Another Characterization for Planar Graphs) III 计数(Counting) Introduction 14 逼近求和(Sums and Asymptotics) 14.1 养老金的价值(The Value of an Annuity) 14.2 幂级数求和 Sums of Powers) 14.3 逼近求和(Approximating Sums) 14.4 Hanging Out Over the Edge) 14.5 乘积(Products) 14.6 Double Trouble 14.7 渐进的符号表示(Asymptotic Notation) 15 基数法则(Cardinality Rules) 15.1 由计算另一项计算该项(Counting One Thing by Counting Another) 15.2 计算序列(Counting Sequences) 15.3 广义乘积法则(The Generalized Product Rule) 15.4 除法法则(The Division Rule) 15.5 子集计算(Counting Subsets) 15.6 重复序列(Sequences with Repetitions) 15.7 Counting Practice: Poker Hands 15.8 鸽巢原理(The Pigeonhole Principle) 15.9 包含与排斥(Inclusion-Exclusion) 15.10 组合证明(Combinatorial Proofs) 15.11 References 16 母函数(Generating Functions) 16.1 无穷级数(Infinite Series) 16.2 使用母函数进行计数(Counting with Generating Functions) 16.3 部分分式(Partial Fractions) 16.4 求解线性递归(Solving Linear Recurrences) 16.5 形式幂级数(Formal Power Series) 16.6 References IV 概率论(Probability) Introduction 17 事件和概率空间(Events and Probability Spaces) 17.1 Let's Make a Deal 17.2 四步法(The Four Step Method) 17.3 Strange Dice 17.4 生日原则(The Birthday Principle) 17.5 集合论和概率论(Set Theory and Probability) 17.6 References 18 条件概率(Conditional Probability) 18.1 Monty Hall Confusion 18.2 定义和符号(Definition and Notation) 18.3 条件概率的四步法(The Four-Step Method for Conditional Probability) 18.4 为什么树状图如此有效(Why Tree Diagrams Work) 18.5 全概法则(The Law of Total Probability) 18.6 辛普森悖论(Simpson's Paradox) 18.7 独立性(Independence) 18.8 相互独立性(Mutual Independence) 18.9 概率与置信度(Probability versus Confidence) 19 随机变量(Random Variables) 19.1 随机样本(Random Variable Examples) 19.2 独立性(Independence) 19.3 分布函数(Distribution Functions) 19.4 期望(Great Expectations) 19.5 线性期望(Linearity of Expectation) 20 平均偏差(Deviation from the Mean) 20.1 马尔可夫定理(Markov‘s Theorem) 20.2 切比雪夫定理(Chebyshev's Theorem) 20.3 方差的性质(Properties of Variance) 20.4 随机样本估计(Estimation by Random Sampling) 20.5 估计置信度(Confidence in an Estimation) 20.6 随机变量加和(Sums of Random Variables) 20.7 Really Great Expectations 21 随机步(Random Walks)
第5页 1.2 labview2011新特性 第6页 1.3 安装labview 第11页 1.4 思考与练习 第12页 第2章 开始labview编程 第12页 2.1 启动labview 第13页 2.2 基本概念介绍 第13页 2.2.1 vi与子vi 第13页 2.2.2 前面板 第16页 2.2.3 后面板 第18页 2.3 菜单栏及工具栏 第18页 2.3.1 菜单栏 第19页 2.3.2 工具栏 第20页 2.4 设置个性化编程环境 第20页 2.4.1 工具选板 第22页 2.4.2 控件选板 第24页 2.4.3 函数选板 第24页 2.4.4 其他编程选项设置 第28页 2.5 vi的基本操作 第28页 2.5.1 vi的创建与编辑 第31页 2.5.2 vi的运行与调试 第33页 2.5.3 子vi的操作 第36页 2.6 获取labview帮助 第36页 2.6.1 即时上下文帮助 第36页 2.6.2 查找范 第36页 2.6.3 在线帮助 第37页 2.7 综合实:创建一个“虚拟信号源”程序 第39页 2.8 思考与练习 第40页 第3章 了解labview的数据类型 第40页 3.1 基本数据类型 第43页 3.1.1 数值型 第46页 3.1.2 布尔型 第46页 3.1.3 字符串型与路径 第47页 3.1.4 枚举型 第48页 3.1.5 簇 第48页 3.1.6 数组 第50页 3.2 特殊数据类型 第50页 3.2.1 波形数据 第50页 3.2.2 时间标识 第51页 3.2.3 变体 第51页 3.3 数据类型之间的转换 第51页 3.3.1 不同数字类型之间的转换 第53页 3.3.2 数字/字符串转换 第56页 3.3.3 字符串/数组/路径转换 第57页 3.3.4 布尔值/数字值转换 第58页 3.3.5 数字与时间标识的转换 第59页 3.4 数据运算与操作 第59页 3.4.1 基本数学运算与操作 第61页 3.4.2 字符串运算与操作 第64页 3.4.3 布尔运算与操作 第65页 3.4.4 比较运算 第69页 3.4.5 数组与矩阵操作 第74页 3.4.6 簇操作 第76页 3.4.7 波形数据操作 第77页 3.5 综合实:温度报警装置 第78页 3.6 思考与练习 第79页 第4章 数据表达与显示 第79页 4.1 基本数据表达与显示 第79页 4.1.1 数值型数据的表达与显示 第87页 4.1.2 布尔型数据的表达与显示 第91页 4.1.3 字符型数据的表达与显示 第94页 4.2 二维图形 第94页 4.2.1 波形图与波形图表 第105页 4.2.2 xy图和express xy图 第106页 4.2.3 强度图表与强度图 第107页 4.2.4 数字波形图和混合波形图 第109页 4.3 三维图形 第110页 4.3.1 三维曲面图 第112页 4.3.2 三维参数图 第113页 4.3.3 三维曲线图 第113页 4.4 其他图形显示控件 第114页 4.4.1 极坐标图 第115页 4.4.2 最小-最大曲线显示控件 第116页 4.5 综合实:绘制同心圆 第116页 4.6 思考与练习 第117页 第5 章程序结构 第118页 5. 1基本程序结构 第118页 5.1.1 for循环 第122页 5.1.2 while循环 第123页 5.1.3 顺序结构 第127页 5.2 特殊程序结构 第127页 5.2.1 条件结构 第130页 5.2.2 事件结构 第134页 5.2.3 定时结构 第138页 5.2.4 禁用结构 第140页 5.3 变量 第140页 5.3.1 局部变量 第142页 5.3.2 全局变量 第145页 5.3.3 共享变量 第146页 5.4 综合实:等差序列求和 第147页 5.5 思考与练习 第148页 第6章 外部程序接口与扩展 第148页 6.1 dll调用 第152页 6.2 windows api调用 第156页 6.3 可执行程序的调用 第157页 6.4 activex调用 第166页 6.5 labview与matlab混合编程 第167页 6.6 综合实:通过调用动态链接库实现驱动开发 第169页 6.7 思考与练习 第170页 第7章 数学分析 第170页 7.1 基本数学分析 第170页 7.1.1 初等与特殊函数 第172页 7.1.2 线性代数 第175页 7.1.3 微积分 第178页 7.1.4 多项式 第180页 7.2 数理统计与最优化问题 第180页 7.2.1 概率与统计 第181页 7.2.2 最优化 第184页 7.3 曲线拟合与插值 第184页 7.3.1 曲

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值