zoukankan      html  css  js  c++  java
  • 5.15 复习;共5题

    一.输出100以内与7有关的数
    /public void Seven()
            //{
            //    Console.WriteLine("100以内与七有关的数:");
            //    int count = 0;
            //    for (int num = 1; num <= 100; num++)
            //    {
            //        if ((num % 10 == 7) || (num / 10 == 7) || (num % 7 == 0))
            //            count++;
            //        Console.Write(num+"	");
            //    }
            //    Console.WriteLine("共有" + count + "个");
            //}
    
    二.游戏闯关得分,
            ///  1-20:自己分,21-30:每关10分,31-40:每关20分,41-49:每关30分,50:100分
            ///  求总分数
            /// </summary>
            public void Score() 
            {
                Console.Write("请输入关卡数:");
                int g = int.Parse(Console.ReadLine());
              
                if (g>0||g<50)
              {
                    int sum=0;
              for ( int i=1;i<=g;i++);
              {
              if (g<=20)
                  {
                     sum+=1;
                  }
                  else if (g<=30)
                  {
                  sum +=10;
                  }
                  else if (g<=40)
                  {
                    sum+=20;
                   }
                  else if (g<=49)
                  {
                  sum+=30;
                  }
              else 
                   {
                  sum+=100;
                  }
    
                }
                    Console.WriteLine(sum);
                }
                else 
                {
                Console.WriteLine("输入有误");
                }
            }
    /// <summary>
         
    
     三.99口诀表,一行一行打印
            /// </summary>
            //public void JiujiuTable()
            //{
            //    for (int hang = 1; hang <= 9; hang++)
            //    {
            //        for (int lie = 1; lie <= hang; lie++)
            //        {
            //            Console.Write(lie + "*" + hang + "=" + hang * lie+"	");
            //         }
            //        Console.WriteLine();
            //    }
            //    Console.ReadLine();
            //}
    /// <summary>
           
    
            /// <summary>
            四. 100以内的奇数和
            /// </summary>
            //public void jishuhe() 
            //{
            //   
            //  for (int num = 1; num <= 100; num += 2)
            //    {
            //       sum+=sum
            //        Console.WriteLine(“100以内的奇数和:"+sum);
            //    }
            //}
    /// <summary>
    
    
           五.1分钱,2分钱,5分钱的硬币,组合出来6角钱,三种硬币都有,共有几种方式
    
    
            /// </summary>
            //public void yingbi()
            //{
            //    int count = 0;
            //    for (int x= 1; x<60; x++)
            //    {
            //        for(int y= 1; y<30; y++)
            //        {
            //            for(int z= 1; z<12; z++)
            //            {
            //     if (x + y * 2 + z * 5 == 60)
            //         {
            //          count++;
            //  Console.WriteLine("1分钱" + x + "个,2分钱" + y + "个,5分钱" + z + "个");
            //                }
            //            }
            //        }
            //    }
            //    Console.WriteLine("共有"+count+"种方法");
            //}
  • 相关阅读:
    Leetcode 剑指 Offer 27(二叉树的镜像)
    Leetcode 1022从根到叶的二进制之和
    Leetcode 993二叉树的堂兄弟节点
    Leetcode 965单值二叉树
    Leetcode 938 二叉搜索树的范围和
    hdu 2082 找单词
    母函数模板
    hdu 1398 Square Coins
    hdu 1085 Holding Bin-Laden Captive!
    hdu 1028 Ignatius and the Princess III
  • 原文地址:https://www.cnblogs.com/suiyuejinghao123/p/5503513.html
Copyright © 2011-2022 走看看