C#中用while和do,while循环语句计算1-100的奇数和偶数和的代码怎么写

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/17 06:39:00

C#中用while和do,while循环语句计算1-100的奇数和偶数和的代码怎么写

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("使用While结构计算");
int oddSum = 0,evenSum=0,i = 1;
while (i