新手,求解控制台的输入一个整数,再以倒数输出
求解控制台的输入一个整数,再以倒数输出
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please input a number:");
try
{
Single s = Convert.ToSingle(Console.ReadLine());
Console.WriteLine("The output should be:1/" + s);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
}
}
仅供参考