FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 87   



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)
  }

Output:

Enter bill amount:
 50000
Enter discount percentage:
 30
After discount your bill is:  35000



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News