Created
August 26, 2017 01:45
-
-
Save Notoh/4cbbe49ed305d40960548ef0d85c2075 to your computer and use it in GitHub Desktop.
average program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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