Java program to print the sum of all numbers in a given array
KW.java
classKW{publicstaticvoidmain(Stringargs[]){doublesum=0;double[]a={100,15,15.15,40,45.99};for(inti=0;i<a.length;i++){sum=sum+a[i];}System.out.println("The addition of array is = "+sum);}}
Output
kodingwindow@kw:~$ javac KW.java kodingwindow@kw:~$ java KW
The addition of array is = 216.14000000000001
kodingwindow@kw:~$
Dear User, Thank you for visitng Kodingwindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.
Dear User, We are grateful for your interest in the Kodingwindow Android app. We intend to soon make it available on the Google Play Store. Currently, Android versions 10 and up require manual apk installations. Would you like to get the app?