{"id":1324,"date":"2022-03-02T18:59:54","date_gmt":"2022-03-02T18:59:54","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1324"},"modified":"2022-03-02T18:59:54","modified_gmt":"2022-03-02T18:59:54","slug":"add-two-integers","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/03\/02\/add-two-integers\/","title":{"rendered":"Add Two Integers"},"content":{"rendered":"\n<p>In this program, you&#8217;ll learn to store and add two integer numbers in Java. After addition, the final sum is displayed on the screen.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Program to Add Two Integers<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>class Main {\n\n  public static void main(String&#91;] args) {\n    \n    System.out.println(\"Enter two numbers\");\n    int first = 10;\n    int second = 20;\n    \n    System.out.println(first + \" \" + second);\n\n    \/\/ add two numbers\n    int sum = first + second;\n    System.out.println(\"The sum is: \" + sum);\n  }\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><samp>Enter two numbers\n10 20\nThe sum is: 30<\/samp><\/code><\/pre>\n\n\n\n<p>In this program, two integers&nbsp;<code>10<\/code>&nbsp;and&nbsp;<code>20<\/code>&nbsp;are stored in integer variables&nbsp;<var>first<\/var>&nbsp;and&nbsp;<var>second<\/var>&nbsp;respectively.<\/p>\n\n\n\n<p>Then,&nbsp;<var>first<\/var>&nbsp;and&nbsp;<var>second<\/var>&nbsp;are added using the&nbsp;<code>+<\/code>&nbsp;operator, and its result is stored in another variable&nbsp;<var>sum<\/var>.<\/p>\n\n\n\n<p>Finally,&nbsp;<var>sum<\/var>&nbsp;is printed on the screen using&nbsp;<code>println()<\/code>&nbsp;function.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this program, you&#8217;ll learn to store and add two integer numbers in Java. After addition, the final sum is displayed on the screen. Program to Add Two Integers Output: In this program, two integers&nbsp;10&nbsp;and&nbsp;20&nbsp;are stored in integer variables&nbsp;first&nbsp;and&nbsp;second&nbsp;respectively. Then,&nbsp;first&nbsp;and&nbsp;second&nbsp;are added using the&nbsp;+&nbsp;operator, and its result is stored in another variable&nbsp;sum. Finally,&nbsp;sum&nbsp;is printed on the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[287],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1324"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=1324"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1324\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}