隨筆 - 71  文章 - 15  trackbacks - 0
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          因?yàn)榭诳剩系蹌?chuàng)造了水;
          因?yàn)楹诎担系蹌?chuàng)造了火;
          因?yàn)槲倚枰笥眩陨系圩屇銇?lái)到我身邊
          Click for Shaanxi xi'an, Shaanxi Forecast
          ╱◥█◣
            |田|田|
          ╬╬╬╬╬╬╬╬╬╬╬
          If only I have such a house!
          〖總在爬山 所以艱辛〗
          Email:myesjoy@yahoo.com.cn
          NickName:yesjoy
          MSN:myesjoy@hotmail.com
          QQ:150230516

          〖總在尋夢(mèng) 所以苦痛〗

          常用鏈接

          留言簿(3)

          隨筆分類(lèi)

          隨筆檔案

          文章分類(lèi)

          文章檔案

          Hibernate在線

          Java友情

          Java認(rèn)證

          linux經(jīng)典

          OA系統(tǒng)

          Spring在線

          Structs在線

          專家專欄

          企業(yè)信息化

          大型設(shè)備共享系統(tǒng)

          工作流

          工作流產(chǎn)品

          網(wǎng)上購(gòu)書(shū)

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

           1 //求和:1+2+3  + 100
           2 public class getSum { 
           3  public static void sums1(int temp)
           4  {
           5   int addResult1=0;
           6   addResult1 = (1+temp)*temp/2;    
           7   System.out.println("addResult1===>"+addResult1);
           8  }
           9  public static void sums2(int temp)
          10  {
          11   int i;
          12   int addResult2 = 0;
          13   for(i=1;i<(temp+1);i++)
          14   {
          15    addResult2 = addResult2 + i;
          16   }
          17   System.out.println("addResult2===>"+addResult2);
          18  }
          19  public static void main(String[] args) {
          20   int s = 100;
          21   sums1(s);
          22   sums2(s);
          23  }
          24 }
          25 
          1   private void countNo(){
          2    int iStart = 1;
          3    int iEnd = 100;
          4    int iCount = 100;
          5   
          6    System.out.println((iStart + iEnd ) * iCount / 2);
          7   }
          8 
          9 
          1#include<stdio.h>
          2void main()
          3{
          4 int a=0,sum=0;
          5 for(a=1,a<101,a=a+1)
          6 sum=sum+a;
          7 printf(“%d“,sum);
          8}
          1 #include<stdio.h>
          2 void main()
          3 {
          4  int a=100,sum=0;
          5  sum=((a+1)*a)/2;//數(shù)學(xué)公式
          6  printf("%d",sum);
          7 }
           1 main()
           2 {
           3  int sum,i;
           4  i=1;
           5  sum=0;
           6  while(i<=100)
           7  { 
           8   sum=sum+i;i++;
           9  }
          10  printf("sum=%d\n",sum);
          11 }
          posted on 2006-01-19 14:39 ★yesjoy★ 閱讀(802) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): 算法總結(jié)
          主站蜘蛛池模板: 腾冲县| 恩平市| 繁峙县| 普定县| 齐齐哈尔市| 静宁县| 山东省| 若尔盖县| 民乐县| 秭归县| 丁青县| 清水县| 石阡县| 株洲市| 宽城| 赫章县| 富阳市| 永宁县| 抚远县| 叙永县| 莎车县| 商河县| 大埔县| 谢通门县| 赣榆县| 虞城县| 绥德县| 双江| 鹰潭市| 莱州市| 桃源县| 汕头市| 郯城县| 余江县| 昌图县| 翁牛特旗| 秦皇岛市| 图片| 镇远县| 开封市| 深泽县|