+0  
 
0
833
2
avatar
what is "one more than the difference of two numbers"
 May 30, 2012
 #1
avatar
0
(x-y) + 1
 May 30, 2012
 #2
avatar+3146 
0
123:

(x-y) + 1



almost..
x=5
y=4
(x-y) + 1 = (5-4)+1 = 2

but:
x=4
y=5
(x-y) + 1 = (4-5)+1 = 0 (not correct)

modified formula:
abs(x-y) + 1

x=4
y=5
(x-y) + 1 = abs(4-5)+1 = abs(-1) + 1 = abs(1) +1 = 2
 May 30, 2012

4 Online Users