{"id":813,"date":"2017-08-14T03:46:50","date_gmt":"2017-08-14T03:46:50","guid":{"rendered":"http:\/\/people.utm.my\/kohmenghock\/?page_id=813"},"modified":"2017-08-14T03:46:50","modified_gmt":"2017-08-14T03:46:50","slug":"example-of-fortran-code-kinetic-energy","status":"publish","type":"page","link":"https:\/\/people.utm.my\/kohmenghock\/example-of-fortran-code-kinetic-energy\/","title":{"rendered":"Example of Fortran code : kinetic energy"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>program kinetic_energy<br \/>\nimplicit none<br \/>\nreal K, m, v ! declare the types of these variables<\/p>\n<p>open(unit=1, file=&#8217;result&#8217;, status=&#8217;replace&#8217;) ! open a file to store results<\/p>\n<p>!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\n! Request for input from user                                                  !<br \/>\n!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\nprint*, &#8220;Give the mass of the object (in unit of kilogram)&#8221;<br \/>\nread*, m<\/p>\n<p>print*, &#8220;Give the velocity of the object (in unit of meter per second)&#8221;<br \/>\nread*, v<\/p>\n<p>!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\n! Calculation of kinetic energy                                                !<br \/>\n!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\nK = m*(v**2.0)\/2.0<br \/>\n! K = m*(v*v)\/2.0 !This form is also possible<\/p>\n<p>!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\n! Print results on the terminal                                                !<br \/>\n!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\nprint*<br \/>\nprint 100, &#8220;The kinetic energy of the object is&#8221;, K, &#8220;Joules&#8221;<br \/>\n100 format(a,1x,f8.3,1x,a)<\/p>\n<p>!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\n! Print results into the file                                                  !<br \/>\n!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\nwrite(1,'(a,1x,f8.3,1x,a)&#8217;) &#8220;The kinetic energy of the object is&#8221;, K, &#8220;Joules&#8221;<\/p>\n<p>!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\n! Close result file                                                            !<br \/>\n!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;!<br \/>\nclose(1)<\/p>\n<p>end program<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; program kinetic_energy implicit none real K, m, v ! declare the types of these variables open(unit=1, file=&#8217;result&#8217;, status=&#8217;replace&#8217;) ! open a file to store results !&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;! ! Request for input from user ! !&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;! print*, &#8220;Give the mass of the object (in unit of kilogram)&#8221; read*, m print*, &#8220;Give the velocity of the object &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/people.utm.my\/kohmenghock\/example-of-fortran-code-kinetic-energy\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Example of Fortran code : kinetic energy&#8221;<\/span><\/a><\/p>\n","protected":false},"author":14180,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-813","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/people.utm.my\/kohmenghock\/wp-json\/wp\/v2\/pages\/813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.utm.my\/kohmenghock\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/people.utm.my\/kohmenghock\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/people.utm.my\/kohmenghock\/wp-json\/wp\/v2\/users\/14180"}],"replies":[{"embeddable":true,"href":"https:\/\/people.utm.my\/kohmenghock\/wp-json\/wp\/v2\/comments?post=813"}],"version-history":[{"count":0,"href":"https:\/\/people.utm.my\/kohmenghock\/wp-json\/wp\/v2\/pages\/813\/revisions"}],"wp:attachment":[{"href":"https:\/\/people.utm.my\/kohmenghock\/wp-json\/wp\/v2\/media?parent=813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}