Ask Question

Define a function named summation. This function expects two numbers, named low and high, as arguments. The function computes and returns the sum of the numbers between low and high, inclusive.

+4
Answers (1)
  1. 11 March, 09:59
    0
    public static int summation (int low, int high) {

    int sum = 0;

    for (int i=low; i<=high; i++) {

    sum + = i;

    }

    return sum;

    }

    Explanation:

    - Initialize sum variable to hold the sum

    - Inside the for loop which iterates from low to high, calculate the sum of the numbers between low and high

    Then:

    - Return the sum
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Define a function named summation. This function expects two numbers, named low and high, as arguments. The function computes and returns ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers