{"id":1327,"date":"2022-03-03T06:47:32","date_gmt":"2022-03-03T06:47:32","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1327"},"modified":"2022-03-03T06:47:32","modified_gmt":"2022-03-03T06:47:32","slug":"multiply-two-floating-point-numbers","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/03\/03\/multiply-two-floating-point-numbers\/","title":{"rendered":"Multiply two Floating Point Numbers"},"content":{"rendered":"\n<p>In this program, you&#8217;ll learn to multiply two floating point numbers in Java, store the result and display it on the screen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example: Multiply Two Floating-Point Numbers<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>public class MultiplyTwoNumbers {\n\n    public static void main(String&#91;] args) {\n\n        float first = 1.5f;\n        float second = 2.0f;\n\n        float product = first * second;\n\n        System.out.println(\"The product is: \" + product);\n    }\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><samp>The product is: 3.0<\/samp><\/code><\/pre>\n\n\n\n<p>In the above program, we have two floating-point numbers&nbsp;<code>1.5f<\/code>&nbsp;and&nbsp;<code>2.0f<\/code>&nbsp;stored in variables&nbsp;<var>first<\/var>&nbsp;and&nbsp;<var>second<\/var>&nbsp;respectively.<\/p>\n\n\n\n<p>Notice, we have used&nbsp;<code>f<\/code>&nbsp;after the numbers. This ensures the numbers are&nbsp;<code>float<\/code>, otherwise they will be assigned &#8211; type&nbsp;<code>double<\/code>.<\/p>\n\n\n\n<p><var>first<\/var>&nbsp;and&nbsp;<var>second<\/var>&nbsp;are then multiplied using the&nbsp;<code>*<\/code>&nbsp;operator and the result is stored in a new float variable&nbsp;<var>product<\/var>.<\/p>\n\n\n\n<p>Finally, the result&nbsp;<var>product<\/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 multiply two floating point numbers in Java, store the result and display it on the screen. Example: Multiply Two Floating-Point Numbers Output In the above program, we have two floating-point numbers&nbsp;1.5f&nbsp;and&nbsp;2.0f&nbsp;stored in variables&nbsp;first&nbsp;and&nbsp;second&nbsp;respectively. Notice, we have used&nbsp;f&nbsp;after the numbers. This ensures the numbers are&nbsp;float, otherwise they will be assigned [&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\/1327"}],"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=1327"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1327\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}