标签:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace day05
{
class Program
{
static void Main(string[] args)
{
/* Console.WriteLine("请输入月份");
int m = Convert.ToInt32(Console.ReadLine());
int c = 0, x = 0, y = 1,z=1;
for (int i = 1; i <= m; i++)
{
if (i>1)
{
c = x + c;
x = y;
y = c;
}
}
z = c + x + y;
Console.Write(m + "个月后总共有" + z + "对兔子,");
Console.Write(c+ "对成兔,");
Console.Write(x + "对小兔,");
Console.Write(y + "对幼兔");
Console.WriteLine("请输入n的值");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
for (int j = 0; j < i; j++)
{
Console.Write("★");
}
Console.Write("\n");
}
Console.WriteLine("----------------------");
for (int a = n; a>0 ; a--)
{
for (int b = 0; b < a; b++)
{
Console.Write("★");
}
Console.Write("\n");
}
Console.ReadKey();
//打印半个菱形
Console.WriteLine("请输入n的值");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
for (int j = 1; j<=n-i; j++)
{
Console.Write(" ");
}
for (int k = 1; k <=i; k++)
{
Console.Write("◆");
}
Console.Write("\n");
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < i; j++)
{
Console.Write(" ");
}
for (int k = 0; k < n-i; k++)
{
Console.Write("◆");
}
Console.Write("\n");
}
Console.ReadKey();
//打印菱形
Console.WriteLine("请输入n的值");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n - i; j++)
{
Console.Write(" ");
}
for (int k = 1; k <= 2 * i - 1; k++)
{
Console.Write("◆");
}
Console.Write("\n");
}
for (int a = 1; a <= n; a++)
{
for (int b = a; b > 0; b--)
{
Console.Write(" ");
}
for (int c = 0; c < 2 * (n - a) - 1; c++)
{
Console.Write("◆");
}
Console.Write("\n");
}
Console.ReadKey();
//for穷举
int m = 0;
for (int i = 1;15*i <=200; i++)
{
for (int j = 1; 3*j <=200; j++)
{
for (int k = 1;2*k <=200; k++)
{
if (15*i+3*j+2*k==200)
{
Console.WriteLine(i + "副球拍," + j + "个球," + k + "瓶水");
m++;
}
}
}
}
Console.WriteLine("共有" + m + "种可能性");
Console.ReadKey();
//打印99乘法表
for (int i = 1; i <=9; i++)
{
for (int j = 1; j <=i; j++)
{
Console.Write(j+ "*"+ i+"="+i*j);
Console.Write("\t");
}
Console.Write("\n");
}
Console.ReadKey();
//百文百鸡
int m = 0;
for (int x =1; 2*x <=100; x++)
{
for (int y = 1; y <=100; y++)
{
for (int z =1;0.5*z <=100; z++)
{
if (2*x+y+0.5*z==100&&x+y+z==100)
{
Console.WriteLine(x+"只公鸡,"+y+"只母鸡,"+z+"只小鸡");
m++;
}
}
}
}
Console.WriteLine("共有"+m+"种可能性");
Console.ReadKey(); */
//一张纸折多少次能和珠穆朗玛峰一样高
int sum = 0;
double a = 0.0007;
for (int i = 0; i <= sum; i++)
{
a = a* 2;
sum++;
if (a>8848)
{
break;
}
}
Console.WriteLine(sum);
Console.ReadKey();
}
}
}
标签:
原文地址:http://www.cnblogs.com/William-1234/p/4312287.html