Click here to Skip to main content
15,885,366 members
Home / Discussions / C#
   

C#

 
AnswerRe: HTML Tag Pin
Bernhard Hiller9-Aug-16 21:12
Bernhard Hiller9-Aug-16 21:12 
SuggestionRe: HTML Tag Pin
Richard Deeming10-Aug-16 1:21
mveRichard Deeming10-Aug-16 1:21 
QuestionGet Value of Datasource When Selected Item in ComboBox Pin
Mostafa_Hosseini8-Aug-16 5:40
Mostafa_Hosseini8-Aug-16 5:40 
AnswerRe: Get Value of Datasource When Selected Item in ComboBox Pin
OriginalGriff8-Aug-16 6:05
mveOriginalGriff8-Aug-16 6:05 
GeneralRe: Get Value of Datasource When Selected Item in ComboBox Pin
Mostafa_Hosseini8-Aug-16 6:18
Mostafa_Hosseini8-Aug-16 6:18 
GeneralRe: Get Value of Datasource When Selected Item in ComboBox Pin
OriginalGriff8-Aug-16 6:40
mveOriginalGriff8-Aug-16 6:40 
AnswerRe: Get Value of Datasource When Selected Item in ComboBox Pin
henry harrison11-Aug-16 9:03
henry harrison11-Aug-16 9:03 
Generalhow to calculate percentile from excel column? Pin
Mallesh Shantagiri8-Aug-16 0:26
Mallesh Shantagiri8-Aug-16 0:26 
Hello All , i'm stucked in C# , to get the percentile from array of column values .please check the below code and let me know how can i pass the arguments to the method .

C#
public double Percentile(double[] sequence, double excelPercentile)
        {
            Array.Sort(sequence);
            int N = sequence.Length;
            double n = (N - 1) * excelPercentile + 1;
            // Another method: double n = (N + 1) * excelPercentile;
            if (n == 1d) return sequence[0];
            else if (n == N) return sequence[N - 1];
            else
            {
                int k = (int)n;
                double d = n - k;
                return sequence[k - 1] + d * (sequence[k] - sequence[k - 1]);
            }
        }

and i have the array of data - and also k value as 0.95.
percentile(myarray , K);
the above method sending me error . please let me know , what is my mistake.

modified 8-Aug-16 10:57am.

GeneralRe: how to calculate percentile from excel column? Pin
dan!sh 8-Aug-16 0:32
professional dan!sh 8-Aug-16 0:32 
GeneralRe: how to calculate percentile from excel column? Pin
Nicholas Marty8-Aug-16 0:32
professionalNicholas Marty8-Aug-16 0:32 
GeneralRe: how to calculate percentile from excel column? Pin
Cornelius Henning8-Aug-16 1:01
professionalCornelius Henning8-Aug-16 1:01 
GeneralRe: how to calculate percentile from excel column? Pin
ZurdoDev8-Aug-16 1:53
professionalZurdoDev8-Aug-16 1:53 
GeneralRe: how to calculate percentile from excel column? Pin
Slacker0078-Aug-16 2:05
professionalSlacker0078-Aug-16 2:05 
GeneralRe: how to calculate percentile from excel column? Pin
W Balboos, GHB8-Aug-16 3:18
W Balboos, GHB8-Aug-16 3:18 
GeneralRe: how to calculate percentile from excel column? Pin
Pete O'Hanlon8-Aug-16 3:49
mvePete O'Hanlon8-Aug-16 3:49 
GeneralRe: how to calculate percentile from excel column? Pin
Slacker0078-Aug-16 4:07
professionalSlacker0078-Aug-16 4:07 
GeneralRe: how to calculate percentile from excel column? Pin
Mallesh Shantagiri8-Aug-16 18:49
Mallesh Shantagiri8-Aug-16 18:49 
GeneralRe: how to calculate percentile from excel column? Pin
#realJSOP8-Aug-16 4:42
mve#realJSOP8-Aug-16 4:42 
GeneralRe: how to calculate percentile from excel column? Pin
Slacker0078-Aug-16 8:47
professionalSlacker0078-Aug-16 8:47 
GeneralRe: how to calculate percentile from excel column? Pin
Richard Deeming8-Aug-16 10:10
mveRichard Deeming8-Aug-16 10:10 
GeneralRe: how to calculate percentile from excel column? Pin
#realJSOP9-Aug-16 6:02
mve#realJSOP9-Aug-16 6:02 
GeneralRe: how to calculate percentile from excel column? Pin
#realJSOP9-Aug-16 6:02
mve#realJSOP9-Aug-16 6:02 
GeneralRe: how to calculate percentile from excel column? Pin
Slacker0079-Aug-16 6:56
professionalSlacker0079-Aug-16 6:56 
GeneralRe: how to calculate percentile from excel column? Pin
Richard MacCutchan8-Aug-16 21:28
mveRichard MacCutchan8-Aug-16 21:28 
Questioncreate a program Pin
Member 105197957-Aug-16 20:45
Member 105197957-Aug-16 20:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.