Answered You can hire a professional tutor to get the answer.

QUESTION

# Write a function that takes two positive integers which define the values of arange. The function calculates and prints the ratio of the sum of even numbers tothe sum of all the numbers in the range.

Write a function that takes two positive integers which define the values of a

range. The function calculates and prints the ratio of the sum of even numbers to

the sum of all the numbers in the range.

input:

Positive integers ‘start’ and ‘end’

Output:

Ratio of sum of even numbers to the sum of all the numbers in the range defined by the numbers ‘start’ and ‘end’

Explaination:

Let’s say we have the values of ‘start’ and ‘end’ as 2 and 10 respectively. So, numbers between 2 and 10

are 2 , 3, 4 , 5 , 6 , 7, 8, 9 , 10

The sum of even numbesr in the given range is : 2 + 4 + 6 + 8 + 10 = 30

Total sum of all the numbers is 54

Ratio of the sum of even numbers to the sum of all the numbers in this range is 30/54 = 0.555 Hint: An even

number divided by 2 leaves a remainder 0.

LEARN MORE EFFECTIVELY AND GET BETTER GRADES!