Go language program to calculate discount

Views: 141   

Following program shows you how to calculate discount.
In this program we get bill amount and discount from user and shows after discount amount using following formula
Discount = bill - (bill * discount / 100)

package main

import "fmt"

func main() {

  var bill int
  var discount int
  var afterDiscount int
  fmt.Println("Enter bill amount:")
  fmt.Scanf("%d", &bill)
  fmt.Println("Enter discount percentage:")
  fmt.Scanf("%d", &discount)
  afterDiscount = bill - (bill * discount / 100)
  fmt.Println("After discount your bill is: " , afterDiscount)


Enter bill amount:
Enter discount percentage:
After discount your bill is:  35000
On By