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

22 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
  7. This comment has been removed by the author.

    ReplyDelete
  8. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here. python training in bangalore

    ReplyDelete
  9. • 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.

    fire safety training in chennai

    ReplyDelete
  10. I wish to indicate because of you only to bail me out of this specific trouble. As a consequence of checking through the net and meeting systems that were not beneficial, I thought my life was finished.fire and safety courses in chennai

    ReplyDelete
  11. Best R Programming Training in Bangalore offered by myTectra. India's No.1 R Programming Training Institute. Classroom, Online and Corporate training in R Programming
    r programming training

    ReplyDelete
  12. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.
    Also Read : R Programming institutes in Chennai | R Programming Training in Chennai

    ReplyDelete

  13. Great efforts put it to find the list of articles which is very useful to know, Definitely will share the same to other forums. big data training in Velachery | Hadoop Training in Chennai | big data Hadoop training and certification in Chennai | Big data course fees

    ReplyDelete

Add your comments here

Back to Top