Check Nums

版权声明:本文为博主原创文章,采用“署名-非商业性使用-禁止演绎 2.5 中国大陆”授权。欢迎转载,但请注明作者姓名和文章出处。 https://blog.csdn.net/njit_77/article/details/79747300

Challenge

Using the C# language, have the function  CheckNums(num1,num2) take both parameters being passed and return the string  true if  num2 is greater than  num1, otherwise return the string  false. If the parameter values are equal to each other then return the string  -1
Sample Test Cases

Input:3 & num2 = 122

Output:"true"


Input:67 & num2 = 67

Output:"-1"


Check Nums算法检测输入的num1,num2;

如果num2>num1,返回true;

如果num2<num1,返回false;

如果num1==num2,返回-1

        public static string CheckNums(int num1, int num2)
        {
            if (num2 > num1)
            {
                return "true";
            }
            else if (num2 < num1)
            {
                return "false";
            }
            return "-1";
        }


猜你喜欢

转载自blog.csdn.net/njit_77/article/details/79747300