diff --git a/03-basic-types/03-numeric-operations/main.go b/03-basic-types/03-numeric-operations/main.go index 6f9aaec..5148663 100644 --- a/03-basic-types/03-numeric-operations/main.go +++ b/03-basic-types/03-numeric-operations/main.go @@ -7,7 +7,7 @@ import ( func main() { var a, b = 4, 5 - var res1 = (a + b) * (a + b)/2 // Arithmetic operations + var res1 = (a + b) * (a + b) / 2 // Arithmetic operations as int a++ // Increment a by 1 @@ -16,7 +16,10 @@ func main() { var res2 = a ^ b // Bitwise XOR var r = 3.5 - var res3 = math.Pi * r * r // Operations on floating-point type + var res3 = math.Pi * r * r // Operations on floating-point type - fmt.Printf("res1 : %v, res2 : %v, res3 : %v\n", res1, res2, res3) -} \ No newline at end of file + var c, d = 4.0, 5.0 + var res4 = (c + d) * (c + d) / 2 // Arithmetic operations as float + + fmt.Printf("res1 : %v, res2 : %v, res3 : %v, res4 : %v\n", res1, res2, res3, res4) +}