Skip to content

Instantly share code, notes, and snippets.

@Notoh
Created August 26, 2017 01:45
Show Gist options
  • Save Notoh/4cbbe49ed305d40960548ef0d85c2075 to your computer and use it in GitHub Desktop.
Save Notoh/4cbbe49ed305d40960548ef0d85c2075 to your computer and use it in GitHub Desktop.
average program
public class Average {
public static void main(String[] args) {
int temp = 0;
int amount = 0;
for(String string : args) {
try {
temp += Integer.parseInt(string);
amount++;
} catch(Exception e) {
System.exit(0);
}
}
System.out.println((temp/amount));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment