Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
GeneralRe: login from read file.txt Pin
Dave Kreskowiak7-Jan-15 3:42
mveDave Kreskowiak7-Jan-15 3:42 
GeneralRe: login from read file.txt Pin
techker27-Jan-15 4:01
techker27-Jan-15 4:01 
AnswerRe: login from read file.txt Pin
Pete O'Hanlon7-Jan-15 1:02
mvePete O'Hanlon7-Jan-15 1:02 
AnswerRe: login from read file.txt Pin
roya.irani26-Jan-15 22:40
roya.irani26-Jan-15 22:40 
QuestionChecking values in 3 tables Pin
jim123456789jim6-Jan-15 3:44
jim123456789jim6-Jan-15 3:44 
AnswerRe: Checking values in 3 tables Pin
OriginalGriff6-Jan-15 4:08
mveOriginalGriff6-Jan-15 4:08 
AnswerRe: Checking values in 3 tables Pin
Chris Quinn6-Jan-15 4:25
Chris Quinn6-Jan-15 4:25 
QuestionHas anyone every seen this before? The logic doesnt make sense Pin
Member 113371085-Jan-15 18:39
Member 113371085-Jan-15 18:39 
C#
double[] myLottoNums = new double [5];

            double sum = 0;
            double median = 0;

            Console.WriteLine("Please enter five numbers: ");
            for (int i = 0; i < 5; i++)
            {
                Console.Write("Number {0}: ", i+1 );
                myLottoNums[i] = double.Parse(Console.ReadLine());
                sum = myLottoNums[i] +sum ;
                median = (myLottoNums[i]) / myLottoNums.Length;
            }
            Console.WriteLine("Thank you. The numbers are : ");

            foreach (double x in myLottoNums)
            {
                Console.WriteLine("{0}", x);



            }

            Console.WriteLine("The sum is {0}",sum);
            Console.WriteLine("The median is {0} ", median);


Heres my issue. It sums it fine but the average is 1.2 when it SHOULD BE 6 because 30/5=6 NOT 1.2 . So why is the computer reading it like this?

Thanks like always guys. You guys have been very helpful
AnswerRe: Has anyone every seen this before? The logic doesnt make sense Pin
Dominic Burford5-Jan-15 18:48
professionalDominic Burford5-Jan-15 18:48 
GeneralRe: Has anyone every seen this before? The logic doesnt make sense Pin
Member 113371086-Jan-15 6:25
Member 113371086-Jan-15 6:25 
GeneralRe: Has anyone every seen this before? The logic doesnt make sense Pin
BillWoodruff6-Jan-15 6:33
professionalBillWoodruff6-Jan-15 6:33 
AnswerRe: Has anyone every seen this before? The logic doesnt make sense Pin
V.5-Jan-15 20:26
professionalV.5-Jan-15 20:26 
GeneralRe: Has anyone every seen this before? The logic doesnt make sense Pin
Member 113371086-Jan-15 6:35
Member 113371086-Jan-15 6:35 
GeneralRe: Has anyone every seen this before? The logic doesnt make sense Pin
V.6-Jan-15 6:40
professionalV.6-Jan-15 6:40 
Question32-bit process calling Marshal.GetExceptionPointers. Pin
LLAKW5-Jan-15 9:03
LLAKW5-Jan-15 9:03 
Question[EDIT] System.AccessViolationException in Windows 8.1 Pin
Django_Untaken5-Jan-15 6:13
Django_Untaken5-Jan-15 6:13 
GeneralRe: System.AccessViolationException in Windows 8.1 Pin
PIEBALDconsult5-Jan-15 6:23
mvePIEBALDconsult5-Jan-15 6:23 
AnswerRe: System.AccessViolationException in Windows 8.1 Pin
Richard MacCutchan5-Jan-15 7:02
mveRichard MacCutchan5-Jan-15 7:02 
AnswerRe: System.AccessViolationException in Windows 8.1 Pin
Dave Kreskowiak5-Jan-15 7:06
mveDave Kreskowiak5-Jan-15 7:06 
AnswerRe: System.AccessViolationException in Windows 8.1 Pin
jschell5-Jan-15 9:25
jschell5-Jan-15 9:25 
AnswerRe: [EDIT] System.AccessViolationException in Windows 8.1 Pin
Richard MacCutchan5-Jan-15 22:26
mveRichard MacCutchan5-Jan-15 22:26 
GeneralRe: [EDIT] System.AccessViolationException in Windows 8.1 Pin
Django_Untaken5-Jan-15 23:08
Django_Untaken5-Jan-15 23:08 
GeneralRe: [EDIT] System.AccessViolationException in Windows 8.1 Pin
Richard MacCutchan5-Jan-15 23:38
mveRichard MacCutchan5-Jan-15 23:38 
GeneralRe: [EDIT] System.AccessViolationException in Windows 8.1 Pin
Dave Kreskowiak6-Jan-15 13:59
mveDave Kreskowiak6-Jan-15 13:59 
AnswerRe: [EDIT] System.AccessViolationException in Windows 8.1 Pin
Richard Deeming6-Jan-15 2:12
mveRichard Deeming6-Jan-15 2:12 

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.