<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
    <title>Re: c语言 求1+2+3+...+100的值 - Code666 (代码贴、代码片段)</title>
    <description>Re: c语言 求1+2+3+...+100的值 - Code666 (代码贴、代码片段)</description>
    <atom:link href="http://www.code666.cn/view/rss/55c7bb3a" rel="self" type="application/rss+xml" />
    <link>http://www.code666.cn/</link>
    <language>en</language>
<item>
    <title>Re: Re: c语言 求1+2+3+...+100的值</title>
    <link>http://www.code666.cn/view/469bed1a</link>
    <pubDate>Wed, 17 Apr 2024 23:56:48 +0800</pubDate>
    <dc:creator>Chunky Iguana</dc:creator>
    <guid isPermaLink="false">http://www.code666.cn/view/469bed1a</guid>
    <description><![CDATA[#include &lt;stdio.h&gt; int main(){ int a,sum; //定义变量 sum=0; //赋初值 for(a=1;a&lt;=100;a++){// for语句循环，当a&lt;=100时执行循环体 sum+=a;//sum=sum+a } printf(&quot;sum=%d&quot;,sum);//输出sum return 0; } ]]></description>
    <content:encoded><![CDATA[<div class="c" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #993333;">int</span> a<span style="color: #339933;">,</span>sum<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//定义变量</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sum<span style="color: #339933;">=</span><span class="nu0">0</span><span style="color: #339933;">;</span> &nbsp;<span style="color: #666666; font-style: italic;">//赋初值</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp;<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">=</span><span class="nu0">1</span><span style="color: #339933;">;</span>a<span style="color: #339933;">&lt;=</span><span class="nu0">100</span><span style="color: #339933;">;</span>a<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">// for语句循环，当a&lt;=100时执行循环体</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp;sum<span style="color: #339933;">+=</span>a<span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//sum=sum+a</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp;<span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sum=%d&quot;</span><span style="color: #339933;">,</span>sum<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//输出sum</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span class="nu0">0</span><span style="color: #339933;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li>
</ol></div>]]></content:encoded>
</item>
</channel>
</rss>
