awesome! you are doing wonderfully
your else will execute if P/2 equal C
can you make this with only two statements? maybe with just an if/else?
I dont get your postā¦
do you mean I should split it into another if/else or what?
okā¦I got what what you are saying now,
you mean I should removed the āelse ifā line if code and turn it to āelseā
so as to make it 2 lines of code rather than 3 lines. right?
yes, you can do it with just
if (...) {
...
} else {
...
}
thanksā¦ I have gotten it
thank you am grateful
Well done, see? You did it! The more you learn the more you realize that all issues, no matter how complex, are made up of small tasks like this one. The more you can break up a big problem into small problems the easier it is to solve.
Also, you can practice a method called ārubber duckā. Go to a dollar store and buy a rubber duck. Or use any small toy animal you may have handy. It could even be your sock that you draw eyes and a mouth on. Or your dog or cat if they like to sit and watch you work.
Try to explain the problem, and your possible solutions to your rubber duck/cat/dog/sock puppet. This is a good way to help clear out some cobwebs when other programmers are not nearby.
in your solution, you have to use Math.floor(P/2) should P/2 be a decimal. So far, you have done a wonderful job ok