将1-100之间的能被7整除的书输出
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
for (int i = 1; i < 101;i++)
if(i%7==0)
Console.WriteLine(i +" ");
Console.ReadKey();
}
}
}
编辑电视歌手大奖赛评分程序,美味评委的打分从键盘给入,直到输入-1,去掉一个最高分,再去掉一个最低分,求评委给出的最后得分(设至少有两位一下个的评委)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
List<double> _lCount = new List<double>();
double _inNum;
double sum = 0;
do
{
Console.WriteLine("input :");
_inNum = double.Parse(Console.ReadLine());
if (_inNum == -1)
break;
_lCount.Add(_inNum);
} while (true);
_lCount.Sort();
_lCount.RemoveAt(0);
_lCount.RemoveAt(_lCount.Count - 1);
sum = _lCount.Sum(); //.NET Framework 3.5
Console.WriteLine("end :" + sum);
Console.ReadKey();
}
}
}