return语句使用时一般有两种格式
1.return;
2.return表达式;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
while (true)
{
Console.WriteLine("请输入三个数,按回车键确认每个数的输入:");
double a = double.Parse(Console.ReadLine());
double b = double.Parse(Console.ReadLine());
double c = double.Parse(Console.ReadLine());
double ave = average(a, b, c);
Console.WriteLine("您输入三个数的平均值为{0}",ave);
}
}
static double average(double a, double b, double c)
{
return (a + b + c) / 3;
}
}
}