go go
This commit is contained in:
33
profitCalculator/app.go
Normal file
33
profitCalculator/app.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var revenue float64
|
||||
var expenses float64
|
||||
var taxRate float64
|
||||
|
||||
fmt.Print("Revenue: ")
|
||||
fmt.Scan(&revenue)
|
||||
|
||||
fmt.Print("Expenses: ")
|
||||
fmt.Scan(&expenses)
|
||||
|
||||
fmt.Print("Tax Rate: ")
|
||||
fmt.Scan(&taxRate)
|
||||
|
||||
ebt := revenue - expenses
|
||||
profit := ebt * (1 - taxRate/100)
|
||||
ratio := ebt / profit
|
||||
|
||||
fmt.Println(ebt)
|
||||
fmt.Println(profit)
|
||||
fmt.Println(ratio)
|
||||
}
|
||||
|
||||
func getUserInput(infoText string) float64 {
|
||||
var userInput float64
|
||||
fmt.Print(infoText)
|
||||
fmt.Scan(&userInput)
|
||||
return userInput
|
||||
}
|
||||
3
profitCalculator/go.mod
Normal file
3
profitCalculator/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module example.com/profit-calculator
|
||||
|
||||
go 1.23.1
|
||||
Reference in New Issue
Block a user