public/subjects/getascii
Michele Sessa f19d5f5341 docs(go checkpoint exercises): fix paths for 3 new exercises
exercises: countcharacter, getalpha, getascii
2023-07-04 12:04:27 +01:00
..
README.md docs(go checkpoint exercises): fix paths for 3 new exercises 2023-07-04 12:04:27 +01:00

README.md

getascii

Instructions

Write a program that takes a character as an argument, and displays the correspondent ASCII code followed by a newline.

  • If the input is more than one character, return a newline \n.
  • If the number of arguments is less than 1, return a newline \n.
  • If the number of arguments is more than 1, return a newline \n.
  • If the the input is a non ascii character, return a newline \n.

Usage

console
$ go run . "W" | cat -e
87$
$
$ go run . "W" "Q" "T" | cat -e
$
$
$ go run . "^" | cat -e
94$
$
$ go run . 7 | cat -e
55$
$
$ go run . a | cat -e
97$
$
$ go run . "Stay Home" | cat -e
$
$ go run .
$