# Amdocs Coding Question | Range of Positive Numbers

Hello friends, I hope you all are doing great. In this post today we will learn to solve the  coding questions which is being asked by the Amdocs company recently. If you are preparing for selection in any company then this post will help you definitely.

Lets Start

Range of Positive Numbers

Given a range of positive numbers where 'rFrom' is the lower and 'rTo' is the upper bound, return a list that contains all the numbers in the range that are dividable by the sum of their sum.

For Example:

rFrom=10

rTo=20

The function will return

10,12,18,20

Explanation:

10/(1+0)=10

12/(1+2)=4

Example :-

• Input:
• 10
• 20
• Output:
• 10,12,18,20

Explanation:-

10/(1+0)=10  , 12/(1+2)=4 etc

Code in Python

```# Code in Python
class TestImpl:
def range(self, rFrom, rTo):
for i in range(rFrom, rTo + 1):
temp = i
sum = 0
while (temp != 0):
r = temp % 10
sum += r;
temp = int(temp / 10)
if (i % sum == 0):
print(i, end=' ')

obj = TestImpl()
obj.range(10, 20)

"""
OUTPUT
10 12 18 20
"""
```

Code in Java
```import java.util.Scanner;

class Range {

static void range(int rFrom,int rTo) {
int sum,temp,r;
for (int i = rFrom; i <= rTo; i++) {
temp=i;
sum=0;
while(temp!=0)
{
r=temp%10;
sum+=r;
temp/=10;
}
if(i%sum==0)
System.out.print(i+" ");
}
}

public static void main(String[] args) {
range(10, 20);
}
}
/*
OUTPUT
10 12 18 20
*/
```

Request:-If you found this post helpful then let me know by your comment and share it with your friend.

If you want to ask a question or want to suggest then type your question or suggestion in comment box so that we could do something new for you all.

If you have not subscribed my website then please subscribe my website. Try to learn something new and teach something new to other.

Thanks