Go 语言计算单利程序

编写一个 Go 语言程序来计算单利。此 Go 语言程序允许用户输入总本金、利率和年数,然后计算单利。计算单利的公式是:

单利 = (本金 * 利率 * 年数) / 100

package main

import "fmt"

func main() {

    var amount, InterestRate, time, simpleI float64

    fmt.Print("Enter the Principal or Total Amount = ")
    fmt.Scanln(&amount)

    fmt.Print("Enter the rate of Interest = ")
    fmt.Scanln(&InterestRate)

    fmt.Print("Enter the Total number of Years = ")
    fmt.Scanln(&time)

    simpleI = (amount * InterestRate * time) / 100

    fmt.Println("\nThe Simple Interest  = ", simpleI)
}
Go Program to calculate Simple Interest