FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 41   



Following program shows you how to calculate salary hike.
In this program we get salary per month and hike from user and calculate new salary with hike using following formula
Salary hike = oldSalaryPerMonth + (oldSalaryPerMonth X hike/100)

package main

import "fmt"

func main() {

  var oldSalaryPerMonth int
  var hike int
  var presentSalaryPerMonth int
  fmt.Println("Enter your old salary per month:")
  fmt.Scanf("%d", &oldSalaryPerMonth)
  fmt.Println("Enter your hike percentage:")
  fmt.Scanf("%d", &hike)
  presentSalaryPerMonth = oldSalaryPerMonth + (oldSalaryPerMonth * hike/100)
  fmt.Println("After hike your present salary per month is: " , presentSalaryPerMonth )
  }

Output:

Enter your old salary per month:
 200000
Enter your hike percentage:
 10
After hike your present salary per month is:  220000



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News