All things are lawful, but not all things are profitable.
Anton Plotnikov wrote:i want write this function.
what code do I need to insert?
Thou shalt not try me. Mom 24:7
Anton Plotnikov wrote:i want write this function.
what code do I need to insert?
That is a good start but then you go straight on to pseudocode for loops. How do you know you will want loops? Isn't that jumping ahead a bit?Quazi Irfan wrote:. . . Before we jump start writing the code lets look at the steps we need to take to solve the problem. . . .
Campbell Ritchie wrote:How do you know you will want loops? Isn't that jumping ahead a bit?
But there is a more efficient way to total those numbers. We don't know how much the OP knows, nor whether he wants efficiency or whether he has been told to write a loop.Quazi Irfan wrote:. . . Most people would repeatedly add numbers to get a sum of a range. . . .
There are three kinds of actuaries: those who can count, and those who can't.
. . . or whether the deadline for this assignment has passedPiet Souris wrote:. . . wait . . . whether he has gotten some ideas yet.
Anton Plotnikov wrote:
Note: a and b are not ordered!
Campbell Ritchie wrote:But there is a more efficient way to total those numbers.
There are three kinds of actuaries: those who can count, and those who can't.
Lakshmanan Arun
http://devtoolzone.com
Yes, but the corrections required for a loop will be more than those required for a simple formula.Lakshman Arun wrote:Does it matter here whether a is smaller or larger than b? . . .
salvin francis wrote:...but here's a clause that's missed by others above ...
Lakshman Arun wrote:Does it matter here whether a is smaller or larger than b?
salvin francis wrote:Hi Anton Plotnikov,
Welcome to Code ranch. I think the problem is simple, but here's a clause that's missed by others above :
Anton Plotnikov wrote:
Note: a and b are not ordered!
This means that you might need to swap the parameters if a is greater than b
With regards to the solution, are you familiar with IntStream ? Hint : There are 2 methods in the IntStream interface that can help you with your assignment.
They all will if you threaten to hit them if they don't.ras oscar wrote:. . . . Not sure if all the loop structures will accept negative integers?
ras oscar wrote:...Not sure if all the loop structures will accept negative integers?
There are three kinds of actuaries: those who can count, and those who can't.
Easier?Piet Souris wrote:Or even much easier . . .
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Or even much easier: ...
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Since OP didn't react to all the simple things we wrote, I tried to be funny. But the mrs is right, she always tell me I have no talent at all for being funny. So from now on I'll stick to being the old grumpy man I always was.
All things are lawful, but not all things are profitable.
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|