zoukankan      html  css  js  c++  java
  • 一个偶数等于两个奇数之和,求组成偶数E的两个奇数的所有组合

        class Program
        {
            static void Main(string[] args)
            {
                //退出条件
                bool exit = true;
                //一直循环直到退出条件为fals
                while (exit)
                {
                    //goto到开始
                start:
                    Console.WriteLine("Enter a even number:");
                    string a = Console.ReadLine();
                    int E;
                    //移除首尾空白并转换为小写
                    if (a.ToLower().Trim() == "exit")
                    {
                        //退出
                        exit = false;
                    }
                    //判断输入是否为数字
                    bool result = int.TryParse(a, out E);
                    if (result)
                    {
                        //如果数字为0或者是偶数跳转到开始重新输入
                        while (E % 2 != 0 || E == 0)
                        {
                            goto start;
                        }
                        for (int i = 1; i < E; i++)
                        {
                            while (i % 2 != 0 && i + i < E)
                            {
                                Console.WriteLine("{0}+{1}={2}", i, E - i, E);
                                break;
                            }
                        }
                    }
                }
            }
        }
  • 相关阅读:
    如何在dede栏目设置中添加自定义字段(dede二次开发-纯抄贴)
    dedecms内容页 上下篇 添加文章描述方法
    关于透明层----背景透明字不透明的效果
    什么是JavaScript闭包终极全解之一——基础概念
    phpcms v9中调用多栏目的方法--get标签(备实例)
    PHP识别电脑还是手机访问网站
    PHP中 post 与get的区别 详细说明
    js 处理数据里面的空格
    mysql中的unix_timestamp函数
    PHP中date函数月和日带0问题
  • 原文地址:https://www.cnblogs.com/ahjesus/p/1998656.html
Copyright © 2011-2022 走看看