Skip to content

Commit

Permalink
Create Average.java
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinzEugen7 committed Nov 26, 2015
1 parent 38ec059 commit 886c309
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Java/Basic/Average.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
public static void main( String[] args ) {
int sum = 0;
int[] data = { 1, 2, 3, 4, 5};
for( int i=0; i<data.length; i++ ) {
sum += data[i];
}
float ave = ( (float)sum )/data.length;
System.out.println(ave);
}
}

0 comments on commit 886c309

Please sign in to comment.