Probability for three randomly chosen numbers to be in AP | C # program to find probability that 3 randomly chosen numbers form AP . ; function to calculate probability ; Driver code
using System ; class GFG { static double procal ( int n ) { return ( 3.0 * n ) / ( 4.0 * ( n * n ) - 1 ) ; } public static void Main ( ) { int [ ] a = { 1 , 2 , 3 , 4 , 5 } ; int n = a . Length ; Console . Write ( Math . Round ( procal ( n ) * 1000000.0 ) / 1000000.0 ) ; } }