add: printf exercises
This commit is contained in:
25
07-printf/exercises/04-print-the-temperature/main.go
Normal file
25
07-printf/exercises/04-print-the-temperature/main.go
Normal file
@ -0,0 +1,25 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE: Print the Temperature
|
||||
//
|
||||
// Print the current temperature in your area using Printf
|
||||
//
|
||||
// NOTE
|
||||
// Do not use %v verb
|
||||
// Output "shouldn't" be like 29.500000
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
// Temperature is 29.5 degrees.
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func main() {
|
||||
// ?
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Printf("Temperature is %.1f degrees.\n", 29.5)
|
||||
}
|
Reference in New Issue
Block a user