id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

gaurav.gupta@mq.edu.au variables > getDigit
prev  |  next  |  chance

In programming languages, characters have a corresponding numerical value. In the older days, this was known as ASCII value, now there's an extended set called Unicode values. The Unicode values for 'A' to 'Z' are 65 to 90 in sequence. The Unicode values for 'a' to 'z' are 97 to 112 in sequence. The Unicode values for '0' to '9' are 48 to 57 in sequence. Define a function that when passed an integer (assuming it's between 48 and 57), returns the digit (as a character) corresponding to it.


getDigit(48) → "0"
getDigit(57) → "9"
getDigit(53) → "5"

...Save, Compile, Run (ctrl-enter)

char getDigit(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 2 Post-solution available

Copyright Nick Parlante 2017 - privacy