第五天学习内容 for循环,嵌套

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();


         

 

          
        }
    }
}

转载于:https://www.cnblogs.com/William-1234/p/4312287.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值