From a7d0911b52bb5a08de4ab8cf6a9d2eb842b00a27 Mon Sep 17 00:00:00 2001 From: Augusto Date: Wed, 2 Oct 2019 23:46:03 +0100 Subject: [PATCH] itoabase program readme --- subjects/itoabaseprog.en.md | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 subjects/itoabaseprog.en.md diff --git a/subjects/itoabaseprog.en.md b/subjects/itoabaseprog.en.md new file mode 100644 index 000000000..8f7e72771 --- /dev/null +++ b/subjects/itoabaseprog.en.md @@ -0,0 +1,39 @@ +## itoabaseprog + +### Instructions + +Write a program that: + +- converts a number in base 10 into the number in the specified base +- the program receives two parameter: + - the first is the value + - the second is the base + +The base is expressed as an `int`, from 2 to 16. The characters comprising +the base are the digits from 0 to 9, followed by uppercase letters from A to F. + +For example, the base `4` would be the equivalent of "0123" and the base `16` would be the equivalent of "0123456789ABCDEF". + +If the value is negative, the resulting `string` has to be preceded with a +minus sign `-`. + +### Expected output + +```console +student@ubuntu:~/piscine-go/itoabaseprog$ go build +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 15 16 +F +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 255 2 +11111111 +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog -4 2 +-100 +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog -df sdf +The value "-df" can not be converted to int +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 23 ew +The value "ew" can not be converted to int +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 4 23 + +student@ubuntu:~/piscine-go/itoabaseprog$ 323 12 +22B +student@ubuntu:~/piscine-go/itoabaseprog$ +``` \ No newline at end of file