R4R Java SourceCode Calculate Average

Calculate Average

In this example we are calculating the average.

SOURCE CODE

class average
{
public static void main(String args[])
{
int nums[]={12,12,32,46,36,47,47,55};
int result=0;
int i;
for(i=0;i<8;i++)
result=result+nums[i];
System.out.println("average is"+result/8);
}
}

Download Source File

[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]
[an error occurred while processing this directive]