⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 06年3月29日_经典c程序(16-20)_老古开发网文章.htm

📁 经典的单片机c语言程序,适合于初学者学习和练习编程
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0032)http://www.laogu.com/wz_1387.htm -->
<HTML><HEAD><TITLE>06年3月29日_经典c程序(16/20)_老古开发网文章</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content=经典c程序(16/20) name=keywords>
<META content=有关经典c程序(16/20)的新闻和技术文章 name=description><LINK 
href="06年3月29日_经典c程序(16-20)_老古开发网文章.files/category.css" type=text/css 
rel=stylesheet>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY vLink=#0000ff bgColor=#ffffff leftMargin=5 topMargin=5>
<DIV align=center>
<TABLE class=tableMain width=736 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <TABLE cellSpacing=2 cellPadding=2 width=728 align=center bgColor=#fdfce8 
      border=0>
        <TBODY>
        <TR>
          <TD width=290>
            <DIV align=left><A 
            href="http://www.zlgmcu.com/tools/LogicAnalyser/LA-logic.asp" 
            target=_blank><IMG height=60 
            src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/zlg.gif" width=290 
            border=0></A></DIV></TD>
          <TD width=146>
            <DIV align=center><A href="http://www.laogu.com/GUANGGAO.HTM" 
            target=_blank>整站广告招商</A></DIV></TD>
          <TD width=125>
            <DIV align=center><A href="http://www.jdisplay.net/" 
            target=_blank><IMG height=60 
            src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/chengqi.gif" width=140 
            border=0></A></DIV></TD>
          <TD width=149>
            <DIV align=right><A 
            href="http://www.techshine.com/peixun/peixun.asp" target=_blank><IMG 
            height=60 src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/techshine.gif" 
            width=140 border=0></A></DIV></TD></TR>
        <TR>
          <TD><A href="http://www.eflagtech.com/" target=_blank><IMG height=60 
            src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/yiqisite.gif" width=290 
            border=0></A></TD>
          <TD><A href="http://www.laogu.com/GUANGGAO.HTM" target=_blank><IMG 
            height=60 src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/quanzhan.gif" 
            width=140 border=0></A></TD>
          <TD>&nbsp;</TD>
          <TD>
            <DIV align=right></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE class=tableMain cellSpacing=0 cellPadding=0 width=736 align=center 
border=0>
  <TBODY>
  <TR>
    <TD>
      <SCRIPT type=text/javascript><!--
google_ad_client = "pub-1420557601534669";
google_ad_width = 728;
google_alternate_ad_url = "http://www.laogu.com/my/welcome.gif";
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "93c901";
google_color_url = "000000";
//--></SCRIPT>

      <SCRIPT src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/show_ads.js" 
      type=text/javascript>
</SCRIPT>
    </TD></TR>
  <TR>
    <TD></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=736 bgColor=#93c901 border=0>
  <TBODY>
  <TR>
    <TD width=160 bgColor=#ffffcc height=2>
      <DIV align=left><A href="http://www.laogu.com/article.aspx"><IMG height=70 
      src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/xinwen.gif" width=160 
      border=0></A></DIV></TD>
    <TD width="80%" bgColor=#ffffcc height=2>
      <TABLE height=70 width=390 align=center bgColor=#fdfce8 border=0>
        <TBODY>
        <TR>
          <TD width=284>
            <DIV align=center><A 
            href="http://www.eetchina.com/STATIC/SITE/WEBINAR.HTM?sources=3rdpartners" 
            target=_blank><IMG height=60 
            src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/EDC_THC_banner_laogu.gif" 
            width=400 border=0></A></DIV></TD>
          <TD width=41>
            <DIV align=right></DIV></TD></TR></TBODY></TABLE></TD>
    <TD width=156 bgColor=#ffffcc>
      <DIV align=right><A href="http://www.laogu.com/"><IMG height=70 
      alt=老古开发网首页 src="06年3月29日_经典c程序(16-20)_老古开发网文章.files/newhome.gif" 
      width=156 border=0></A></DIV></TD></TR></TBODY></TABLE>
<TABLE class=tableMain cellSpacing=1 cellPadding=3 width=736 border=0>
  <TBODY>
  <TR>
    <TD vAlign=top bgColor=#ffffff colSpan=2>
      <DIV class=s10 align=center>
      <DIV align=center></DIV>
      <DIV align=center></DIV></DIV>
      <DIV align=center>
      <TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" align=center 
      border=0 valign="top">
        <TBODY>
        <TR>
          <TD align=left height=25><STRONG><BR>导航:</STRONG><A 
            href="http://www.laogu.com/">老古开发网首页</A>→<A 
            href="http://www.laogu.com/article.aspx">文章分类</A>→<A 
            href="http://www.laogu.com/ctg_6.htm">单片机</A>→<A 
            href="http://www.laogu.com/ctg_6_16.htm">第16页</A>→[<FONT 
            color=#004800>经典c程序(16/20)</FONT>] <BR>| -<A 
            href="http://www.laogu.com/searchnews.aspx" target=_blank>文章搜索</A> - 
            <A href="http://www.laogu.com/articlenew.aspx" 
            target=_blank>最新文章</A> - | <BR>
            <DIV align=center>
            <H3>第1387篇:经典c程序(16/20)</H3></DIV></TD></TR>
        <TR>
          <TD class=table vAlign=top bgColor=#ffffff>发布时间:2006年3月28日 
            <BR>点击次数:71 <BR>
            <TABLE class=rcontent cellSpacing=0 width="100%" bgColor=#93c901 
            border=1>
              <TBODY>
              <TR>
                <TD></TD></TR></TBODY></TABLE>详细内容:经典c程序(16/20)<BR><BR>
            <P>题目:求1+2!+3!+...+20!的和<BR>1.程序分析:此程序只是把累加变成了累乘。 
            <BR>2.程序源代码:<BR>main()<BR>{<BR>float 
            n,s=0,t=1;<BR>for(n=1;n&lt;=20;n++)<BR> {<BR> t*=n;<BR> s+=t;<BR> }<BR>printf("1+2!+3!...+20!=%e\n",s);<BR>}<BR></P>
            <P>题目:有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。<BR>1.程序分析:请抓住分子与分母的变化规律。 
            <BR>2.程序源代码:<BR>main()<BR>{<BR>int n,t,number=20;<BR>float 
            a=2,b=1,s=0;<BR>for(n=1;n&lt;=number;n++)<BR> {<BR> s=s+a/b;<BR> t=a;a=a+b;b=t;/*这部分是程序的关键,请读者猜猜t的作用*/<BR> }<BR>printf("sum 
            is %9.6f\n",s);<BR>}</P>
            <P>题目:打印出如下图案(菱形) </P>
            <P>*<BR>***<BR>******<BR>********<BR>******<BR>***<BR>*<BR>1.程序分析:先把图形分成两部分来看待,前四行一个规律,后三行一个规律,利用双重<BR>      for循环,第一层控制行,第二层控制列。 
            <BR>2.程序源代码:<BR>main()<BR>{<BR>int 
            i,j,k;<BR>for(i=0;i&lt;=3;i++)<BR> {<BR> for(j=0;j&lt;=2-i;j++)<BR>  printf(" 
            ");<BR> for(k=0;k&lt;=2*i;k++)<BR>  printf("*");<BR> printf("\n");<BR> }<BR>for(i=0;i&lt;=2;i++)<BR> {<BR> for(j=0;j&lt;=i;j++)<BR>  printf(" 
            ");<BR> for(k=0;k&lt;=4-2*i;k++)<BR>  printf("*");<BR> printf("\n");<BR> }<BR>}<BR></P>
            <P>
            <TABLE cellSpacing=0 cellPadding=0 width="94%" align=center 
border=0>
              <TBODY>
              <TR>
                <TD><FONT 
                  color=#000000>题目:两个乒乓球队进行比赛,各出三人。甲队为a,b,c三人,乙队为x,y,z三人。已抽签决定<BR>   比赛名单。有人向队员打听比赛的名单。a说他不和x比,c说他不和x,z比,请编程序找出<BR>   三队赛手的名单。 
                  <BR>1.程序分析:判断素数的方法:用一个数分别去除2到sqrt(这个数),如果能被整除,<BR>      则表明此数不是素数,反之是素数。 
                        <BR>2.程序源代码:<BR>main()<BR>{<BR>char 
                  i,j,k;/*i是a的对手,j是b的对手,k是c的对手*/<BR>for(i=''x'';i&lt;=''z'';i++)<BR> for(j=''x'';j&lt;=''z'';j++)<BR> {<BR> if(i!=j)<BR>  for(k=''x'';k&lt;=''z'';k++)<BR>  { 
                  if(i!=k&amp;&amp;j!=k)<BR>   { 
                  if(i!=''x''&amp;&amp;k!=''x''&amp;&amp;k!=''z'')<BR>   printf("order 
                  is 
                  a--%c\tb--%c\tc--%c\n",i,j,k);<BR>   }<BR>  }<BR> }<BR>}<BR></FONT></TD></TR></TBODY></TABLE></P>
            <P>题目:猴子吃桃问题:猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个<BR>   第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下<BR>   的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘了多少。<BR>1.程序分析:采取逆向思维的方法,从后往前推断。<BR>2.程序源代码:<BR>main()<BR>{<BR>int 
            day,x1,x2;<BR>day=9;<BR>x2=1;<BR>while(day&gt;0)<BR> {x1=(x2+1)*2;/*第一天的桃子数是第2天桃子数加1后的2倍*/<BR> x2=x1;<BR> day--;<BR> }<BR>printf("the 
            total is %d\n",x1);<BR>}<BR></P>
            <DIV align=left>
            <P><BR></P>
            <P><FONT color=#ff0000>欢迎进入<A href="http://www.laogu.com/laogubbs/" 
            _target="_blank">老古论坛</A>对经典c程序(16/20)进行讨论<BR></FONT></P></DIV><BR></TD>
        <TR>
          <TD class=table vAlign=top bgColor=#ffffff></TD>
        <TR>
          <TD class=table vAlign=top bgColor=#ffffff></TD>
        <TR>
          <TD>上一个:<A 
          href="http://www.laogu.com/wz_1388.htm">经典c程序(17/20)</A></TD></TR>
        <TR>
          <TD>下一个:<A 
          href="http://www.laogu.com/wz_1386.htm">经典c程序(15/20)</A></TD></TR>
        <TR>
          <TD class=date vAlign=top 
    bgColor=#ffffff></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></DIV>
<DIV align=center><A href="http://www.laogu.com/">老古开发网</A>版权所有 2005年11月 asp.Net 
设计:<A href="http://www.laogu.com/">老古</A>,<BR>2006-3-29 15:54:17 页面缓存:否 125毫秒 
</DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -