FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 88   



Following program shows you how to convert hours to seconds.
In this program we get hours from user, once we get those we need to multiply with 60 so that we get in minutes, and once we get minutes we need to multiply with 60 so that we get in seconds

package main

import "fmt"

func main() {

  var hours int
  var seconds int
  fmt.Println("Please enter hours:")
  fmt.Scanf("%d", &hours)
  seconds = hours * 60 * 60
  fmt.Println(seconds , " Seconds")
}

Output:

Please enter hours:
 4
14400  Seconds



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News