Java Program to add Array Elements | Sum of array Elements

Publié le: 26 avril 2023
sur la chaîne: Techie coding
180
11

Program to find the sum of the elements in the array :

Simple and Easy Steps :

Input : arr [ ] = {10, 20, 30, 40}
Output : 100
10 + 20 + 30 + 40 = 100

Algorithm Steps :
Step 1 : Initialize an Integer array arr[ ] and take its length as input from user.

Step 2 : Store the Elements into the array using for loop.

Step 3 : Print the Entered Array Elements.

Step 4 : Declare a variable sum and Initialize as sum = 0.

Step 5 : Start a for loop from index 0 to the length of the array – 1.

In every iteration, perform sum = sum + arr[i].
After the termination of the loop, print the value of the sum.

====================================

Data Structures and Algorithm :
👉    • DS & Algorithms + Implementation in Java  

====================================

Thank you for Watching :

Happy coding Keep Learning 😊

====================================

subscribe for more videos :

   / @techie_coding  

   / @techie_coding  

   / @techie_coding  

====================================

#javaprogramming #arrayinjava #sumofarrayelements
#javatutorialforbeginners #java #corejava #arraybasics
#eclispe #javatutorial #addarrayelements


Sur cette page du site, vous pouvez voir la vidéo en ligne Java Program to add Array Elements | Sum of array Elements durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Techie coding 26 avril 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 180 fois et il a aimé 11 téléspectateurs. Bon visionnage!