From 3a6231c49cf8561d7f68fab94021d214625e94e8 Mon Sep 17 00:00:00 2001 From: zainabdnaya Date: Tue, 2 Aug 2022 21:03:13 +0100 Subject: [PATCH] Not decimal subject --- subjects/notdecimal/README.md | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 subjects/notdecimal/README.md diff --git a/subjects/notdecimal/README.md b/subjects/notdecimal/README.md new file mode 100644 index 000000000..ab86a4d5a --- /dev/null +++ b/subjects/notdecimal/README.md @@ -0,0 +1,42 @@ +## Not_decimal + +### Instructions + +Write a function called `Not_decimal()` that takes a float number with the decimal point and return an integer with the decimal point (you muliply by 10^n to remove `.`). + +- if the number is doesn'the have a decimal point or there is only zero after `.` return the number. + + +### Expected function + +```go +func Not_decimal(month int) int { +} +``` +### Usage + +Here is a possible program to test your function : + +```go +package main + +import "fmt" + +func main() { + fmt.Println(Not_decimal(0.1)) + fmt.Println(Not_decimal(1.2)) + fmt.Println(Not_decimal(0.15)) + fmt.Println(Not_decimal(1.256)) + fmt.Println(Not_decimal(0.00009)) +} +``` +And its output : + +```go +$ go run . +1 +12 +15 +1256 +9 +``` \ No newline at end of file