using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication5
{
class Program
{
public float calavg(int a,int b,int c,out int sum)
{
sum = a + b + c;
return sum / 3;
}
public float calavg2(int a, int b, int c, ref int sum)
{
sum = a + b + c;
return sum / 3;
}
static void Main(string[] args)
{
Program p=new Program();
int d1=54, d2=78, d3=100,s=0;
float avg;
/* avg = p.calavg(d1, d2, d3,out s);
Console.WriteLine("total score is "+s);
Console.WriteLine("avg score is "+avg);
*/
avg= p.calavg2(d1, d2, d3, ref s);
Console.WriteLine("total score is " + s);
Console.WriteLine("avg score is " + avg);
Console.ReadLine();
}
}
}
No comments:
Post a Comment