Views: 121
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
Navya
Top Tutorials
492.5K
32K
21.8K
18.7K
18.7K
6.7K
6.7K
4.9K
3.3K
3.2K
Top Questions
18.7K
14.5K
8.3K
6.6K
6.2K
5.7K
4.8K
4.8K
4.3K
3.9K
Top Articles
1.9K
1.6K
947
Top Blogs
796
779
55
Top News
754
686
670
398
385
385