隨筆 - 71  文章 - 15  trackbacks - 0
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          因為口渴,上帝創(chuàng)造了水;
          因為黑暗,上帝創(chuàng)造了火;
          因為我需要朋友,所以上帝讓你來到我身邊
          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

          〖總在尋夢 所以苦痛〗

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          Hibernate在線

          Java友情

          Java認證

          linux經典

          OA系統(tǒng)

          Spring在線

          Structs在線

          專家專欄

          企業(yè)信息化

          大型設備共享系統(tǒ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;//數學公式
          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★ 閱讀(809) 評論(0)  編輯  收藏 所屬分類: 算法總結
          主站蜘蛛池模板: 高雄县| 宕昌县| 临颍县| 加查县| 怀集县| 抚宁县| 荣昌县| 太康县| 台湾省| 栾城县| 葫芦岛市| 兰坪| 阳泉市| 德惠市| 翼城县| 永年县| 闵行区| 山东| 资阳市| 湛江市| 诸暨市| 连山| 大理市| 政和县| 安平县| 清水县| 洱源县| 讷河市| 防城港市| 法库县| 介休市| 宜昌市| 云南省| 和顺县| 邹平县| 开封县| 济阳县| 广东省| 东安县| 连州市| 平原县|