函数Y的表达式如下,输入一个X的值,求Y的值 x x

学习 时间:2026-06-05 22:15:26 阅读:3544
函数Y的表达式如下,输入一个X的值,求Y的值 x x

最佳回答

苗条的飞机

直率的外套

2026-06-05 22:15:26

class Program { static void Main(string[] args) { string str = Console。ReadLine(); int x; try { x = Convert。ToInt32(str); } catch (FormatException e) { return; } float y = Method(x); Console。WriteLine("y = " + y。ToString()); Console。ReadLine(); } static float Method(int x) { float y = 0; if (x < 0) { y = x; } else if (0 < x && x

最新回答共有2条回答

  • 过时的彩虹
    回复
    2026-06-05 22:15:26

    class Program { static void Main(string[] args) { string str = Console。ReadLine(); int x; try { x = Convert。ToInt32(str); } catch (FormatException e) { return; } float y = Method(x); Console。WriteLine("y = " + y。ToString()); Console。ReadLine(); } static float Method(int x) { float y = 0; if (x < 0) { y = x; } else if (0 < x && x

上一篇 什么时候去北京最好译成英语:When is the -- --to go to Beijing.

下一篇 我的自传作文600字