using System;
using System.Collections.Generic;
using System.Text;
namespace FindTheNumber //这里感觉和c++很像
{
class Program
{
static void Main(string[] args) //c#声明数组时,方括号 ([]) 必须跟在类型后面,而不是标识符后面
这里和c语言是相反的
{
int [] rg = // 初始化数组
{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
20,21,22,23,24,25,26,27,28,29,30,31};
for (Int64 i = 1; i < Int64.MaxValue; i++) //Int64 值类型表示值介于 -9,223,372,036,854,775,808 到 +9,223,372,036,854,775,807 之间的整数。
{
int hit = 0;
int hit1 = -1;
int hit2 = -1;
for (int j = 0; (j < rg.Length) && (hit <=2) ; j++)
{
if ((i % rg[j]) != 0)
{
hit++;
if (hit == 1)
{
hit1 = j;
}
else if (hit == 2)
{
hit2 = j;
}
else
break;
}
}
if ((hit == 2)&& (hit1+1==hit2))
{
Console.WriteLine("found {0}", i);
}
}
}
}
}
问题1:这个程序要找的是符合什么条件的数?
答:这是在网上查的:Int64 值类型表示值介于 -9,223,372,036,854,775,808 到 +9,223,372,036,854,775,807 之间的整数。
至于程序,不太能看懂