Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# average of 3 numbers

// define a double with 3 parameters each being a number between 1 & 100 (ln 9)
static double avrg(double num1, double num2, double num3 ){
    double average = (num1 + num2 + num3) / 3;
    return average;
}
Random rnd = new Random();
// new random class

Console.WriteLine(avrg(rnd.Next(1, 101), rnd.Next(1, 101), rnd.Next(1, 101)));

// wait before closing
Console.ReadKey();
 
PREVIOUS NEXT
Tagged: #average #numbers
ADD COMMENT
Topic
Name
9+2 =