﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title> Find mean of all elements in integer array </Title>
            <Description> Expansion snippet to calculate mean of all elements in the array. </Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>          
                <SnippetType> Expansion </SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID> Array </ID>
                    <Default > nArray </Default>
                    <ToolTip> Array containing elements whose mean has to be calculated. </ToolTip>
                </Literal>
            </Declarations>
            <Code Language="vjsharp" Format="CData"><![CDATA[
double dMeanValue = 0;
for (int i = 0; i < $Array$.length; i++)
{
// Compute the sum of all values in the array
    dMeanValue = dMeanValue  + $Array$[i];
}
//Compute the mean of the values in the array
dMeanValue = dMeanValue / $Array$.length;
$selected$ $end$
]]>
</Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
