标签:
class hanshu { public void qiuhe(int n) { int sum = 0; for (int i = 0; i <= n; i++) { sum += i; } Console.Write("求和结果为"+sum); } static void Main(string[] args) { hanshu hs = new hanshu(); Console.Write("输入数字:"); int n = int.Parse(Console.ReadLine()); hs.qiuhe(n); Console.ReadLine(); } }
class Program { public string fanhuinihao() { return "你好"; } static void Main(string[] args) { Program fh=new Program(); string s = fh.fanhuinihao(); Console.Write(s); Console.ReadLine(); } }
标签:
原文地址:http://www.cnblogs.com/liuyudong0825/p/4726005.html