⇧
Contact Us
||
Privacy Policy
||
About Us
Home
Java
Progarm
PHP
Menu ▼
Program
Vowel or Constant
Area of Circle
Find the Triangle
Compound Interest
Prime Number
Reverse Number
Factorial Number
Sum of Element
User Input
Calculate Average
Even or Odd
N Prime Number
1 to n Prime Number
Reverse String
Reverse String by User
Check Leap Year
HexaDecimal String
Binary to Decimal
Get IP
Check ArmStrong
ArmStrong Or Not
next →
← prev
10) Write a program to Calculate average of numbers using Array .
Program
class AverageEx{ public static void main(String[] args) { double[] arr = {17, 12.89, 18.5, 200, 11.7}; double total = 0; for(int i=0; i<arr.length; i++){ total = total + arr[i]; } double average = total / arr.length; System.out.format("The average is: %.3f", average); } }
Next Topic
← prev
next →