1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
yarga [219]
4 years ago
5

Write the definition of a function isPositive, that receives an integer parameter and returns true if the parameter is positive,

and false otherwise. So, if the parameter's value is 7 or 803 or 141 the function returns true. But if the parameter's value is -22 or -57, or 0, the function returns false.
Mathematics
1 answer:
Svetach [21]4 years ago
8 0

Answer:

BEGIN def function isPositive(int parameter)

//test for positivity

if parameter > 0

RETURN true

else

RETURN  false

END def function isPositive

Step-by-step explanation:

A number is a positive integer if it is a whole number and exists between 0 and positive infinity e. g 1, 90000, 42434234 e.t.c. It is a negative integer if it is a whole number and exists between negative infinity and 0(0 may be inclusive). e.g 0, -34342, -6984.

As shown on the first line, to define a function, we begin by writing the name of the function - "isPositive" in this case - followed by a pair of parenthesis which contains the parameter(s) on which the function will act on. In this case, the parameter is an integer - positive or negative.

Line 2 shows a comment describing what happens on the next four lines. i.e  checking whether or not the parameter's value is positive

Then, we write an if-else statement to check whether or not the parameter's value is a positive integer. If the parameter's value is greater than 0, the parameter's value is thus a positive integer then the function will return true. This is shown on lines 3 and 4. Otherwise, the parameter's value is a negative integer, thus the function returns a false as shown on lines 5 and 6.  

The last line in the expression shows the end of the function's definition.

Hope it helps.

You might be interested in
Adrian is using an indirect method to prove that segment DE is not parallel to segment BC in the triangle ABC shown below:
VikaD [51]
If we start with the assumption that segment DE is parallel to segment BC, then we the similarity condition that:
triangle ABC is similar to triangle ADE
For this to be true, the ratio corresponding sides of the two triangles must be equal. So:
5/8 =? 6/10
But
5/8 =/= 6/10

So, DE is not parallel to BC
4 0
3 years ago
A positive angle less than 360 degrees that is coterminal with -5 degrees is
nadya68 [22]

Answer:

\theta = 355

Step-by-step explanation:

Given

Let the angle be \theta

\theta < 360

\theta is co-terminal with -5

Required

Find \theta

Start by dividing 5 by 360 (ignore the negative)

\frac{5}{360} = 0.0138

The nearest integer greater than 0.0138 is 1.

<em>This implies that if you were to draw for this problem, the circle you would draw to show -5 degrees would go around 1 time</em>

So, \theta is calculated as:

\theta = -5 + 1*360

\theta = -5 +360

\theta = 355

7 0
3 years ago
Why do you sometimes need to regroup in 3 digit addition problems
SCORPION-xisa [38]
Because for example 349+567 is something you need to regroup.You start by the ones.9+7=16. You don't always need to regroup though
6 0
3 years ago
How to estimate 5x179
QveST [7]

Answer:

895

Step-by-step explanation:

if u need to estimate, multiple 5 by 180, and then subtract 5

6 0
3 years ago
Jackson bought 5 ounces of raisins for $4 dollar sign. How much do raisins cost per ounce?
Aneli [31]

Answer:

Cost of raisin per ounce = $0.8

Step-by-step explanation:

Solution:

Number of ounces = 5 ounces

Price of 5 ounces= $4

Cost of raisin per ounce = ?

To find out the price per ounce, simply take the total dollar amount of the product and divide it by the number of ounces.

Formula = Price/Number of ounces

= 4/5

=$0.8

Cost of raisin per ounce = $0.8....

4 0
4 years ago
Read 2 more answers
Other questions:
  • Help?? i dont understand how to start this
    6·1 answer
  • A total of 306 tickets were sold for the school play. They were either adult tickets or student tickets. The number of student t
    9·2 answers
  • Can someone solve this?
    12·1 answer
  • Emma scored 4 points more than twice number of points teagan scored. Emma scored 3 points. How many did teagan score
    13·1 answer
  • Please answer this correctly
    7·2 answers
  • 5|x3 - 21 + 7 when x = -2.
    10·1 answer
  • if the distance between the tree and point B is 125 meters, and the angle of depression from the top of the tree to point B is 4
    12·1 answer
  • 1. Shawn has to read 143 pages in his book for his weekly homework. So far, he has
    10·1 answer
  • Loretta invested $3000 into account that earns 6% compounded semiannually how many times will Loretta entrance after keeping the
    8·1 answer
  • The sum of the digits in a two-digit number is 12. The digit in the tens place is 2 more than the digit in the ones place. The s
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!