Java program to find sum of 2 number

Java program to find sum of 2 number
or
Java program to find addition of 2 number

Program:-

import java.util.Scanner;

class group{
public static void main(String arg[]){
int num1, num2, sum;
Scanner data = new Scanner(System.in);
// Reading 1st number
System.out.println("Enter 1st number");
num1 = data.nextInt();
//Reading 1st number
System.out.println("Enter 2nd number");
num2 = data.nextInt();
// Finding sum
sum=num1+num2;
//Displaying sum
System.out.println("sum:"+sum);
}
}


Output:-

Enter 1st number
25
Enter 2nd number
21
sum:46


Output:-

Enter 1st number
-25
Enter 2nd number
23
sum:-2


Output:-

Enter 1st number
25
Enter 2nd number
-21
sum:4


Output:-

Enter 1st number
-56
Enter 2nd number
-84
sum:-140





Learn Java:-
Java codes

Java Programs:-
List of Java Programs

56 Comments

  1. Thanks for sharing this program.It is really helpful.Continue sharing more like this.
    Regards,
    Java Training in Chennai | Java Training Institutes in Chennai | Java courses in Chennai

    ReplyDelete
  2. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
    Best hadoop training institute in chennai|Hadoop Training Chennai|Hadoop Training in Chennai

    ReplyDelete
  3. Nice Post! It is really interesting to read from the beginning & I would like to share your blog to my circles, keep your blog as updated.
    Regards,
    cloud computing training in chennai|cloud computing training

    ReplyDelete
  4. Excellent post!!! The future of cloud computing is on positive side. With most of the companies integrate Salesforce CRM to power their business; there is massive demand for Salesforce developers and administrators across the world.Salesforce Training in Chennai | Salesforce Training Institutes in Chennai

    ReplyDelete
  5. Hi, you have given really informative post. Thanks for sharing this post to our vision. Learn Hadoop Online Training will helps you to reach your goal.Selenium Training

    ReplyDelete
  6. Good and nice informative article, thanks for sharing your information and views...
    Java Training institute in chennai | Best Java Training in velachery

    ReplyDelete
  7. There are lots of information about oracle have spread around the web, but this is a unique one according to me. keep sharing your post.
    No.1 Java Project Center in Chennai | Best Dot Net Projects in Chennai | Best Mini Project Center in Chennai


    ReplyDelete
  8. Thanks for your post; java is most trusted language to validate web browser. This language provides precise and complete information about an application or environment. 
    Best Android Training Institute in Chennai | DotNet Training Institute in Chennai | Web Designing Training Institute in Chennai

    ReplyDelete
  9. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
    big data training in bangalore

    ReplyDelete
  10. I gained more knowledge from your blog..thanks for sharing innovative blog..Java Project Center in Chennai | Java Project Center in Velachery

    ReplyDelete
  11. Great Blog, you have posted posted something new compared to others, I read many article related to this topic but no one explain like this much of clear manner. Best CCNA Training Institute in Chennai | Best CCNP Training Institute in Chennai | Hardware & Networking Training in Chennai

    ReplyDelete
  12. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    aws training in Chennai

    ReplyDelete
  13. Those guidelines additionally worked to become a good way to
    recognize that other people online have the identical fervor like mine
    to grasp great deal more around this condition.

    white label website builder

    ReplyDelete
  14. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    digital marketing training in chennai

    ReplyDelete
  15. It is a one of the great discussion which is very essential for me as well. I must follow the handy discussion and sure that the content will be very useful to me as well. Keep it up. C, C++ Summer Course in Medavakkam | C, C++ Summer Course in Tambaram | C, C++ Summer Courses in Velachery

    ReplyDelete
  16. Nice blog, thank you. A page is being visited more in mobile than pc, so we need to make it as priority as well.
    Good Summer Courses in Porur | Perfect Summer Course in Guindy

    ReplyDelete
  17. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.and thanks for sharing..Best Summer course Training in C and C++ for Students in Kanchipuram|

    ReplyDelete
  18. I gained more knowledge from your blog..thanks for sharing innovative blog.Best summer courses traning for Students in Kanchipuram|





    ReplyDelete
  19. Thanks for sharing this program.It is really helpful.Continue sharing more like this.Best summer course for school students in chennai training in kanchipuram

    ReplyDelete
  20. the blog is very useful, interesting and informative. thank you for sharing the blog with us. keep on updating. Best web designing and development courses in kanchipuram|

    ReplyDelete
  21. the blog is very useful, interesting and informative. thank you for sharing the blog with us. keep on updating. Best Tally ERP 9 Training institute in kanchipuram|

    ReplyDelete
  22. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...

    Best Graphics Designing Training Academy in Kanchipuram

    ReplyDelete
  23. I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference. Best RHCE Training Institute in kanchipuram|

    ReplyDelete
  24. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference. Best tally Erp 9 Training Institute in kanchipuram|

    ReplyDelete
  25. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site. Best Graphic Designing Training Institute in kanchipuram

    ReplyDelete
  26. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    Data Analytics Courses

    ReplyDelete
  27. I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference. Best Web Designing and Development Training Institute in kanchipuram|

    ReplyDelete
  28. Really it was an awesome blog...... Very interesting to read, .It’s very helpful for me, Big thanks for the useful info and keep updating…
    Best Tally Training Academy in Kanchipuram

    ReplyDelete
  29. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
    Best ccnp Training Academy in Kanchipuram

    ReplyDelete
  30. It’s interesting that many of the bloggers to helped clarify a few things for me as
    Well as giving. Most of ideas can be nice content.
    Best Graphic Designing Training Institute in in Kanchipuram

    ReplyDelete
  31. I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
    Best Graphic Designing Training Institute in in Kanchipuram

    ReplyDelete
  32. Your Blog is really awesome with useful and helpful content for us.Thanks for sharing ..keep updating more information.
    Best java Training Institute in in Kanchipuram

    ReplyDelete
  33. Nice post... Really you are done a wonderful job. Thanks for sharing such wonderful information with us. Please keep on updating...
    Best Graphic designing Training Institute in in Kanchipuram

    ReplyDelete
  34. This information is very useful and innovative..I gained more knowledge from this.Thanks for the nice information its very useful to read your blog...
    Best web designing Training Institute in in Kanchipuram

    ReplyDelete
  35. Wonderful article.It is to define the concepts very well.Clearly explain the information.It has more valuable information for encourage me to achieve my career goal.
    Best dally erp 9 Training Institute in in Kanchipuram

    ReplyDelete
  36. Wow, really I am much interested to know our blog content is really good.Great information. Thank you for Sharing.
    Best C++ Training Institute in Kanchipuram

    ReplyDelete
  37. Awesome Post! I like writing style, the way you described the topics throughout the post. I hope many web reader will keep reading your post at the end, Thanks for sharing your view.
    Best web design Training Institute in Kanchipuram

    ReplyDelete
  38. Your Blog is really awesome with useful and helpful content for us.Thanks for sharing .
    You will get an introduction to the Python programming language and understand the importance of it. How to download and work with Python along with all the basics of Anaconda will be taught. You will also get a clear idea of downloading the various Python libraries and how to use them.
    Topics
    About ExcelR Solutions and Innodatatics
    Do's and Don’ts as a participant
    Introduction to Python
    Installation of Anaconda Python
    Difference between Python2 and Python3
    Python Environment
    Operators
    Identifiers
    Exception Handling (Error Handling)

    ReplyDelete
  39. Your article was so impressive and informative. Its very interesting to read. Thanks for sharing,
    Best web design Training Institute in Kanchipuram

    ReplyDelete
  40. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site
    Best dotnet Training Institute in Kanchipuram

    ReplyDelete
  41. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing
    Best graphic designing Training Institute in Kanchipuram

    ReplyDelete
  42. Wonderful article.It is to define the concepts very well.Clearly explain the information.It has more valuable information for encourage me to achieve my career goal.
    Best CCNP Training Institute in Kanchipuram

    ReplyDelete
  43. thank you for such a great article with us. hope it will be much useful for us. please keep on updating..
    Best software testing Training Institute in Kanchipuram

    ReplyDelete

Add your comments here

Back to Top