<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://www.gentoo-zh.org/extern.php?action=feed&amp;tid=345&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Gentoo中文社区 / C 练习实例36 - 求100之内的素数]]></title>
		<link>https://www.gentoo-zh.org/viewtopic.php?id=345</link>
		<description><![CDATA[C 练习实例36 - 求100之内的素数 最近发表的帖子。]]></description>
		<lastBuildDate>Mon, 29 Aug 2022 11:17:04 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[C 练习实例36 - 求100之内的素数]]></title>
			<link>https://www.gentoo-zh.org/viewtopic.php?pid=351#p351</link>
			<description><![CDATA[<p>题目：求100之内的素数。</p><p>程序分析：质数（prime number）又称素数，有无限个。一个大于1的自然数，除了1和它本身外，不能被其他自然数整除。</p><p>程序源代码：</p><div class="codebox"><pre><code>#include&lt;stdio.h&gt;
#include&lt;math.h&gt;
int main()
{
    int i,j,k,n=0;
    for(i=2;i&lt;=100;i++)
    {
        k=(int)sqrt(i);
        for(j=2;j&lt;=k;j++)
            if(i%j==0) break;
        if(j&gt;k)
        {
            printf(&quot;%d &quot;,i);
            n++;
            if(n%5==0)
                printf(&quot;\n&quot;);
        }
    }
    return 0;
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (batsom)]]></author>
			<pubDate>Mon, 29 Aug 2022 11:17:04 +0000</pubDate>
			<guid>https://www.gentoo-zh.org/viewtopic.php?pid=351#p351</guid>
		</item>
	</channel>
</rss>
