課程
/后端開發(fā)
/C#
/C#開發(fā)輕松入門
4-3的練習(xí)題怎么做
2016-10-18
源自:C#開發(fā)輕松入門 4-3
正在回答
if可以換成while嗎
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? int x = 1;
? ? ? ? ? ? int sum = 0;//和,初始化為0
? ? ? ? ? ? while (x <= 30)//循環(huán)條件
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (x%2!=0)//篩選條件
? ? ? ? ? ? ? ? ? ? sum += x;
? ? ? ? ? ? ? ? x++;
? ? ? ? ? ? }
? ? ? ? ? ? Console.Write("1-30奇數(shù)的和:"+sum);
? ? ? ? }
? ? }
}
if(x%2==1)
額 我學(xué)晚了 人都學(xué)完走了 沒人鳥我
不會啊
舉報
本門課程是C#語言的入門教程,將帶你輕松入門.NET開發(fā)
2 回答為什么b=4>3;不行。
3 回答為什么4-3算法求和if不能換成while?
2 回答為什么x >=1了 最后輸出是4 3 2 1 0呢?
3 回答3-4編程練習(xí),為什么不能提交?新手表示很憤怒
3 回答4-2
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2017-08-09
if可以換成while嗎
2016-11-08
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? int x = 1;
? ? ? ? ? ? int sum = 0;//和,初始化為0
? ? ? ? ? ? while (x <= 30)//循環(huán)條件
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (x%2!=0)//篩選條件
? ? ? ? ? ? ? ? ? ? sum += x;
? ? ? ? ? ? ? ? x++;
? ? ? ? ? ? }
? ? ? ? ? ? Console.Write("1-30奇數(shù)的和:"+sum);
? ? ? ? }
? ? }
}
2016-11-04
if(x%2==1)
2016-10-18
額 我學(xué)晚了 人都學(xué)完走了 沒人鳥我
2016-10-18
不會啊