Skip to content

Commit

Permalink
Read float and print truncated
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilswdp committed Jan 21, 2022
1 parent 69d3516 commit cacd181
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package main

import "fmt"

func main() {
func old_main() {
fmt.Println("Hello, World!")
}
12 changes: 12 additions & 0 deletions trunc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import "fmt"

func main() {
var userFloat float32
fmt.Println("Enter a floating point number: ")

fmt.Scan(&userFloat)

fmt.Printf("%.0f", userFloat)
}

0 comments on commit cacd181

Please sign in to comment.