Easy

Determine if the given character is a digit or not.

Example

  • For symbol = '0', the output should be
    isDigit(symbol) = true;
  • For symbol = '-', the output should be
    isDigit(symbol) = false.

Input/Output

  • [execution time limit] 0.5 seconds (c)

  • [input] char symbol

    A character which is either a digit or not.

    Guaranteed constraints:
    Given symbol is from ASCII table.

  • [output] boolean

    • true if symbol is a digit, false otherwise.

[C] Syntax Tips

// Prints help message to the console
// Returns a string
char * helloWorld(char * name) {
    char * answer = malloc(strlen(name) + 8);
    printf("This prints to the console when you Run Tests");
    strcpy(answer, "Hello, ");
    strcat(answer, name);
    return answer;
}

더보기

Solution

bool isDigit(char symbol)
{
	return isdigit(symbol);
}
728x90

'Codesignal' 카테고리의 다른 글

<Codesignal> chessKnight  (0) 2020.04.06
<Codesignal> lineEncoding  (0) 2020.04.06
<Codesignal> Is MAC48 Address?  (0) 2020.04.06
<Codesignal> Elections Winners  (0) 2020.04.06
<Codesignal> buildPalindrome  (0) 2020.04.05

+ Recent posts