java program to find sum array element

java program to take user input

simple java array program

Program:-

import java.util.Scanner;
class group{
public static void main(String arng[]){
int total = 0;
int sum[]=new int[5];
Scanner data = new Scanner(System.in);

System.out.println("Enter 5 element of array");

for(int i=0; i<5;i++)
sum[i] = data.nextInt();
for(int i=0; i<5;i++)
total = total +sum[i];
System.out.println("Sum of array element is:"+total);
}
}

Output:-

Enter 5 elment of array
25
21
23
21
24
Sum of array element is:114

Learn Java:-
Java codes

Java Programs:-
List of Java Programs

8 Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. I really enjoyed reading the Post. It was very informative and useful.
    Best Software Training institute in bangalore
    Best SAP Training institute In Bangalore.
    <a href="http://www.riainstitute.co.in/Advanced-Excel-Training-in-Bangalore.html>Best Advanced Excel Training Institute In Bangalore. </a>

    ReplyDelete
  3. • It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.
    Dotnet Training in Marathahalli

    ReplyDelete
  4. Those rules moreover attempted to wind up plainly a decent approach to perceive that other individuals online have the indistinguishable enthusiasm like mine to get a handle on incredible arrangement more around this condition
    rprogramming training in chennai

    ReplyDelete
  5. I wish to show thanks to you just for bailing me out of this particular trouble.As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.

    java training in bangalore

    ReplyDelete
  6. Appreciating the persistence you put into your blog and detailed
    information you provide.
    dotnet training in bangalore

    ReplyDelete

Add your comments here

Back to Top