logo CodeStepByStep logo

sentinelSum

Write a console program with a main function that prompts the user for numbers until the user types -1, then outputs the sum of the numbers. Here is an example output:

Type a number: 10
Type a number: 20
Type a number: 30
Type a number: -1
Sum is 60
Function: Write a Kotlin function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.