Console.WriteLine("請輸入起點整數(shù)");
int numberOne = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("請輸入終點整數(shù)");
int numberTwo = Convert.ToInt32(Console.ReadLine());
int i = numberOne;
int sum = 1;
while (numberOne < numberTwo)
{
sum = sum + numberOne;
numberOne++;
}
Console.WriteLine("從{0}到{1}之和為{2}", i, numberTwo, sum);
int i=1;
int sum = 0;
do
{
sum = sum + i;
i++;
}while(i
分別使用while do-while for 三種語句編程求1-100的累加和.
分別使用while do-while for 三種語句編程求1-100的累加和.
其他人氣:753 ℃時間:2020-02-20 15:03:05
優(yōu)質(zhì)解答
我來回答
類似推薦
- 分別用 while,do while 和for 循環(huán)計算1+2+……+100的和,C語言編程
- 2、分別用三種循環(huán)語句(while語句、do-while語句、for語句),實現(xiàn)求1~100的累加和
- 用JAVA語言編程 求1!+2!+3!+4!+5!+6!+7!+8!+9!+10!.(要求:使用while、do-while、for三種語句
- 求1-100的累加和分別用while,do...while和for這兩種循環(huán)語句實現(xiàn)
- 分別用for ,while ,do while 語句編程計算1-100之間奇數(shù)和
- 一輛停在山崖前某處的汽車鳴笛后經(jīng)過1.2s聽到回聲在空氣中的傳播速度340m/s則距山崖的距離約為多少?
- 折射的虛像怎么形成的?
- 仿照課文中兩兩對稱的語句,將下列句子補充完整,使之兩兩對稱
- 2.x²-Kx-4 有一個因式為 (x+1) 則另一個因式---- 及 K=------
- 設(shè)集合A={-2},B={x|ax+1=0,a∈B},若A∩B=B,求a的值
- you should go to the park to have a rest同義句
- 英語翻譯
猜你喜歡
- 1求一組蘊含人生哲理的排比句.句中兼用比喻或擬人手法,語言生動形象.
- 2請問,財務(wù)竣工決算審計和工程造價審計用英語如何翻譯?
- 3three mountains are covered with snow,tower over the land.
- 4you have to go to america by piane的同義句
- 5水溶液稱氯水,氯水存在的微粒,分析一下其中存在的分子有 ,離子有 ,
- 6找出古詩詞中詠荷的三句名句,并加以賞析.
- 7分析the doctor has decided what to do.麻煩幫我分析一下 在句子的成分 結(jié)果 什么從句
- 8誰能幫我把中文翻印成英文..就2句..
- 9作一個直角三角形兩個銳角的角平分線,所夾的角是多少度?
- 10陳老師家四月份用水21噸,用電126度,共付水電費132元,其中水費相當于電費的7分之4
- 11以知下列關(guān)于x方程:4(x-3)+2a=負X+5和7x-3=a+x
- 12在實數(shù)單位內(nèi)化簡3-!1-根號下-x²!表示絕對值 今晚8:30前