static void Main(string[] args)
{
int i = 1;
for (; ; )
{
if (i > 100)
{
break;
}
Console.Write(i + "\t");
i++;
}
Console.ReadKey();
}
static void Maine(string[] args)
{
//Console.WriteLine("请输入次数");
//int n = Convert.ToInt32(Console.ReadLine());
//int i = 0;
//for (double sum = 0.0001; sum <= 8848.0; sum = sum * 2)
//{
// i++;
//}
//Console.WriteLine(i);
double sum = 0.0001;
int z = 0;
for (int i = 0; ; i++)
{
z++;
sum = sum * 2;
if (sum >= 8848.0)
{
Console.WriteLine(z);
break;
}
}
}
static void Main6a(string[] args)
{
for (int i = 0; i <= 50; i++)
{
for (int j = 0; j <= 100; j++)
{
for (int k = 0; k <= 200; k++)
{
if ( (i * 2 + j * 1 + k * 0.5 == 100) && (i + j + k == 100) )
{
Thread.Sleep(50);
Console.WriteLine("大马需要" + i + "头,中马需要" + j + "头,小马需要" + k + "头。");
}
}
}
}
}
static void Maing(string[] args)
{
for (int i = 1; i < 10; i++)
{
for (int j = 1; j < 5; j++)
{
for (int k = 1; k < 25; k++)
{
if (i * 5 + j * 10 + k * 25 == 50)
{
Console.WriteLine("50元用来买" + i.ToString() + "个牙刷," + j.ToString() + "个牙膏," + k.ToString() + "块肥皂,正好能用完。");
}
}
}
}
}
static void Mainh(string[] args)
{
int m = 0;
for (int i = 0; i <= 20; i++)
{
for (int j = 0; j <= 10; j++)
{
for (int k = 0; k < 4; k++)
{
if (i * 1 + 2 * j + 5 * k == 20)
{
m++;
Console.WriteLine("一共有" + m + "中方法。");
Console.WriteLine("需要1元的" + i + "张,2元的" + j + "张,5元的" + k + "张。");
}
}
}
}
}
static void Maini(string[] args)
{
for (int i = 1; i <= 1; i += 2)
{
for (int j = -1; j <= 1; j += 2)
{
for (int k = -1; k <= 1; k += 2)
{
for (int l = -1; l <= 1; l += 2)
{
if (1 * i + 2 * j + 3 * k + l * 4 == 4)
{
Console.WriteLine("i=" + i + ",j=" + j + ",k=" + k + ",l=" + l + "。");
}
}
}
}
}
}
static void Maini2(string[] args)
{
for (int a = -1; a <= 2; a += 2)
{
for (int b = -1; b <= 2; b += 2)
{
for (int c = -1; c <= 2; c += 2)
{
for (int d = -1; d <= 2; d += 2)
{
if (123 + a * 45 + b * 67 + c * 8 + d * 9 == 100)
Console.WriteLine("a=" + a + ",b=" + b + ",c=" + c + ",d=" + d);
}
}
}
}
Console.ReadKey();
}
static void Mainj(string[] args)
{
for (int a = 0; a <= 1; a++)
{
for (int b = 0; b <= 1; b++)
{
for (int c = 0; c <= 1; c++)
{
for (int d = 0; d <= 1; d++)
{
for (int e = 0; e <= 1; e++)
{
for (int f = 0; f <= 1; f++)
{
if ((a + b >= 1) && (a + d <= 1) && (a + e + f == 2) && (b + c != 1) && (c + d == 1) && (d - e >= 0))
{
Console.WriteLine("A=" + a + "B=" + b + "C=" + c + "D=" + d + "E=" + e + "F=" + f);
}
}
}
}
}
}
}
}
//老师版
static void Mainj1(string[] args)
{
int a, b, c, d, e, f;
for (a = 0; a < 2; a++)
{
for (b = 0; b < 2; b++)
{
for (c = 0; c < 2; c++)
{
for (d = 0; d < 2; d++)
{
for (e = 0; e < 2; e++)
{
for (f = 0; f < 2; f++)
{
if ((a + b >= 1) && (a + d <= 1) && (a + e + f == 2) && (b + c != 1) && (c + d == 1) && ((d + e == 0) || d == 1))
{
Console.WriteLine("A=" + a + "B=" + b + "C=" + c + "D=" + d + "E=" + e + "F=" + f);
}
}
}
}
}
}
}
Console.ReadKey();
}
//方法一
static void Maink3(string[] args)
{
int syt = 1, byt = 0;
int sxt = 0, bxt = 0;
int sct = 0, bct = 0;
Console.WriteLine("请输入月数:");
int month = Convert.ToInt32(Console.ReadLine());
int sum;
for (int i = 1; i <= month; i++)
{
//赋值顺序不能变,必须按照兔子生长规律来,先有的bct才会有byt
bct = sxt + sct;
bxt = syt;
byt = sxt + sct;
//bct = sxt + sct; 这样写,必须注意他的顺序
//bxt = syt;
//byt = bct;
//byt = bct;//错误的
//bxt = syt;
//bct = sxt + sct;
syt = byt;
sxt = bxt;
sct = bct;
//sum = byt + bxt + bct;
}
sum = byt + bxt + bct;
Console.WriteLine("过了{0}个月后,幼兔个数为{1}对,小兔个数为{2}对,成兔个数为{3}对,总共有{4}对。", month.ToString(), byt, bxt, bct,sum);
}
//方法二
static void Maink4(string[] args)
{
int n = Convert.ToInt32(Console.ReadLine());
int tu = 0;//要求那个月的总数
int tu1=1, tu2=1;//倒数第一个为 tu1,倒数第二个为 tu2
for (int i = 3; i < n;i++ )
{
tu = tu1 + tu2;
tu2 = tu1;
tu1 = tu;
}
Console.WriteLine(tu);
}
//方法三
static void Maink5(string[] args)
{
Console.Write("请输入月数:");
int m = int.Parse(Console.ReadLine());
int ct = 0;//成兔的对数
int xt = 0;//小兔的对数
int yt = 1;//
int zt = 1;//
for (int i = 1; i <= m; i++)
{
if (i == 1)
{
ct = 0;
xt = 0;
yt = 1;
}
else
{
ct = xt + ct;
xt = yt;
yt = ct;
}
zt = yt + xt + ct;
Console.WriteLine(i.ToString() + "个月后成兔的对数是:" + ct.ToString());
Console.WriteLine(i.ToString() + "个月后小兔的对数是:" + xt.ToString());
Console.WriteLine(i.ToString() + "个月后幼兔的对数是:" + yt.ToString());
Console.WriteLine(i.ToString() + "个月后兔子的总对数是:" + zt.ToString());
}
Console.ReadLine();
}
static void Maink(string[] args)
{
int sum = 1;
for (int i = 0; i < 6; i++)
{
int t = (sum + 1) * 2;
sum = t;
}
Console.WriteLine("桃子一共有:" + sum + "个。");
}
try//快捷方式:双击 tab键
{
}
catch (Exception)
{
throw;
}
finally
{
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有