美文网首页
2018-11-01(if+else)(1)

2018-11-01(if+else)(1)

作者: 大长腿快快跑 | 来源:发表于2018-11-01 11:22 被阅读0次
        要求用户输入两个数a、b,如果a被b整除或者a加b大于100,    则输出a的值,否则输出b的值
        Console.WriteLine("请输入a的值:");
        int a = Convert.ToInt32(Console.ReadLine ());
         Console.WriteLine("请输入b的值:");
         int b = Convert.ToInt32(Console.ReadLine());
        if(a % b==0 && a+b >= 100)
        {Console.WriteLine (a);
        }
        else
        {Console.WriteLine (b);
        }

        Console.ReadKey();

相关文章

网友评论

      本文标题:2018-11-01(if+else)(1)

      本文链接:https://www.haomeiwen.com/subject/jsgtxqtx.html