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

 

tmhscs@gmail.com logic > logic_diceRoll
prev  |  next  |  chance

Given two integer dice rolls "die1" and "die2", return their sum, except if they have the same value, return double their sum!


logic_diceRoll(2, 4) → 6
logic_diceRoll(3, 3) → 12
logic_diceRoll(5, 6) → 11

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

public int logic_diceRoll(int die1, int die2) { }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy