The following program will prompt the user for a starting number and an // ending number. Assume that these are whole numbers (no decimal points), // assume the numbers are not negative and assume that the first number is // not larger than the second number. // // write a funcTion that returns the sum of the numbers from the starting // number to the ending number. For example, if the starting number is 13 // and the ending number is 18 then the function will return the value of // 13 + 14 + 15 + 16 + 17 + 18. If the starting number is equal to the ending // number then simply return that number. // //////////////////////////////////////////////////////////////////////////   function sumOfNumbers(startingNumber, endingNumber) {     } var startingNumber = parseInt(prompt('What is the starting number? ')); var endingNumber = parseInt(prompt('What is the ending number? ')); var sumOfNumbersPassed = sumOfNumbers(startingNumber, endingNumber); alert('The sum of the numbers from ' + startingNumber + ' to ' + endingNumber + ' is ' + sumOfNumbersPassed);     Code for Java

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 3E
icon
Related questions
Question
The following program will prompt the user for a starting number and an
// ending number. Assume that these are whole numbers (no decimal points),
// assume the numbers are not negative and assume that the first number is
// not larger than the second number.
//
// write a funcTion that returns the sum of the numbers from the starting
// number to the ending number. For example, if the starting number is 13
// and the ending number is 18 then the function will return the value of
// 13 + 14 + 15 + 16 + 17 + 18. If the starting number is equal to the ending
// number then simply return that number.
//
//////////////////////////////////////////////////////////////////////////

 

function sumOfNumbers(startingNumber, endingNumber) {
 
 
}

var startingNumber = parseInt(prompt('What is the starting number? '));
var endingNumber = parseInt(prompt('What is the ending number? '));
var sumOfNumbersPassed = sumOfNumbers(startingNumber, endingNumber);

alert('The sum of the numbers from ' + startingNumber + ' to ' + endingNumber + ' is ' + sumOfNumbersPassed);
 
 
Code for Java
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning