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

 

digitsEqualOrTwice


boolean digitsEqualOrTwice(int num). Given a 2-digit integer (betwen 10-99 inclusive), return true if both digits are the same, or if one digit is twice the value of the other. NOTE: (n / 10) % 10 will extract the left digit (the digit from the tens-column). n % 10 extracts the right digit (the digit from the ones-column).


digitsEqualOrTwice(24) → true
digitsEqualOrTwice(63) → true
digitsEqualOrTwice(55) → true

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

boolean digitsEqualOrTwice(int num) { }

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: 125

Copyright Nick Parlante 2017 - privacy