<\/span><\/h2>\n\n\n\npackage main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\tvar amount, rate, time, SI float64\n\n\tfmt.Print(\"Enter the principal amount: \")\n\tfmt.Scanln(&amount)\n\n\tfmt.Print(\"Enter the interest rate: \")\n\tfmt.Scanln(&rate)\n\n\tfmt.Print(\"Enter the time period (annually): \")\n\tfmt.Scanln(&time)\n\n\tSI = (amount * rate * time) \/ 100\n\n\tfmt.Print(\"\\nSimple Interest = \", SI)\n}\n<\/pre>\n\n\n\nOutput<\/strong><\/p>\n\n\n\nEnter the principal amount: 12000\nEnter the interest rate: 5\nEnter the time period (annually): 2\n\nSimple Interest = 1200\n<\/code><\/pre>\n\n\n\n<\/span>How Does This Program Work?<\/strong><\/span><\/h2>\n\n\n\n\tvar amount, rate, time, SI float64\n<\/pre>\n\n\n\nWe have declared four float data types named amount, rate, time, and SI.<\/p>\n\n\n\n
\tfmt.Print(\"Enter the principal amount: \")\n\tfmt.Scanln(&amount)\n<\/pre>\n\n\n\nThe program displays a message to the user asking him to enter the principal amount. The principal amount entered by the user gets stored in the named variable.<\/p>\n\n\n\n
\tfmt.Print(\"Enter the interest rate: \")\n\tfmt.Scanln(&rate)\n<\/pre>\n\n\n\nSimilarly, the interest rate is also taken as input from the user. The interest rate gets stored in the rate-named variable.<\/p>\n\n\n\n
\tfmt.Print(\"Enter the time period (annually): \")\n\tfmt.Scanln(&time)\n<\/pre>\n\n\n\nNow, the program asks the user to enter the time. Here, the time interval is calculated annually, so the user is asked to enter the time period in years. The value entered by the user is stored in the time variable.<\/p>\n\n\n\n
\tSI = (amount * rate * time) \/ 100\n<\/pre>\n\n\n\nWe compute simple interest using the values provided by the user.<\/p>\n\n\n\n
The simple interest is computed using the mathematical formula SI = (P x R x T)\/100.<\/p>\n\n\n\n
The value returned after the calculation is stored in the SI variable.<\/p>\n\n\n\n
\tfmt.Print(\"\\nSimple Interest = \", SI)\n<\/pre>\n\n\n\nAt last, the simple interest is printed on the screen using the fmt.Print() method.<\/p>\n\n\n\n
<\/span>Conclusion<\/strong><\/span><\/h2>\n\n\n\nIn this post, you learned how to write a program to calculate simple interest using the Go programming language.<\/p>\n\n\n\n
If you have any doubts regarding the program, please leave your queries in the comment section.<\/p>\n","protected":false},"excerpt":{"rendered":"
In this post, we will learn how to write a program to calculate simple interest using the Go programming language.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[808],"tags":[809],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/8435"}],"collection":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/comments?post=8435"}],"version-history":[{"count":4,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/8435\/revisions"}],"predecessor-version":[{"id":8445,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/8435\/revisions\/8445"}],"wp:attachment":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/media?parent=8435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/categories?post=8435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/tags?post=8435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}