Hello,
I defined and divided the complete range of x into 3 cases.
Case 1:
when x more than or equal to 5
then y=(x+5)-(x-5) = 10
hence y=10
Case 2:
when -5<x<5
y=(x+5)-(-(x-5)) = 2x
y=2x
Case 3:
when x less than or equal to -5
y= -(x+5)-(-(x-5))
y=-10
So i hope all the 3 cases which i have taken into consideration is okay with you.
so
for any value of x more or equal to 5 , y will always take the value of 10
for any value of x less than or equal to -5 , y will always take the value of -10.
hence the only range of values left to consider is -5<x<5
Now , since y can take only integer values and x can be only between -5<x<5
and y = 2x
So , the below combinations are available
x=4.5 , then y = 9
x=4 , then y = 8
x=3.5 , then y = 7
x=3 , then y = 6
x=2.5 , then y = 5
x=2 , then y = 4
x=1.5 , then y = 3
x=1 , then y = 2
x=0.5 , then y = 1
x=0 , then y = 0
x=-0.5 , then y = -1
x=-1 , then y = -2
x= -1.5 , then y = -3
x= -2 , then y = -4
x= -2.5 , then y = -5
x= -3 , then y = -6
x= -3.5 , then y = -7
x=-4 , then y = -8
x=-4.5 , then y = -9
so y can take 19 values from this case.
apart from this from case 1 and 3 , we get y =10 and -10
so in total , y has 21 values ..
Hope , i make this clear for you
![Sad :(](./images/smilies/icon_sad.gif)
PS: in my earlier solution i assumed X is also a integer
![Smile :)](./images/smilies/icon_smile.gif)
Cheers,
Vinay