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]
3 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]3 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
Se tiene que pegar encaje aun aro de 35 centimetros de diametro¿Cuanto encaje se necesita para cubrirlo?
nalin [4]
Cual es la formula?
 cual es???


4 0
3 years ago
Read 2 more answers
Hii pls help i’ll give brainliest if you give a correct answer
allochka39001 [22]

Answer:

A

Step-by-step explanation:

The Moon actually takes 27.3 days to complete one orbit around Earth

5 0
3 years ago
Read 2 more answers
AHHH PLS HELP QUICK ILL GIVE U BRAINLIEST <3​
nika2105 [10]

Answer:

10

Step-by-step explanation:

19 divided by 19 is equal to 1 so you cross out 19 and are left with "b".

190 divided by 19 is equal to 10.

b=10

7 0
2 years ago
Read 2 more answers
Which of the following are interior angles in the figure below?
KATRIN_1 [288]

Answer:

(A), 21, 22,and 26

Step-by-step explanation:

gakzbzkxvuxnsslvzixvdkdbdjxvshhzvskdvxy dgsjzvsks ysjdbdudvsk jdkdbdb

7 0
3 years ago
A pair of equations is shown below:
Archy [21]

Slope Intercept Form - y = mx + b

First you need the slope or m which in the first equation is 6 and in the second is 5

Next the y-intercept or b which in the first equation is -4 and in the second is -3

Here is an image of both equation plotted on a graph where the first equation is purple and the second is green

Hope this helps, if you need anything else i will edit it in :)

edit: The to lines intercept at the point (1,2)

Sorry, i wasn't completely sure what you needed i haven't done this in a while. If you still need more, I'll try to help.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Find the value of x in each case. PLEASE SHOW WORK!!!
    12·1 answer
  • Which angles are consecutive angles?
    6·1 answer
  • Numbers that are both larger than –2 and smaller than 3.
    15·2 answers
  • 7x-11=5(x-2)+2x-1= ?​
    6·1 answer
  • What is the interquartile range of the data set?<br> {48, 50, 65, 60, 80, 42, 45, 50, 42, 55, 45}
    7·1 answer
  • Please help me simplify the expression where possible. (r-3s2t)4
    6·1 answer
  • Consider the ODE, dy dx = y 2 1 + x (2) subject to condition y = 1 when x = 0, use your Euler code from class (modified if neces
    10·1 answer
  • Which expression is equivalent to 30 + 8?
    10·1 answer
  • Value of Pq- qp if p=3 and q = -1?. 1?:)​
    8·1 answer
  • Can someone answer these questions?? Thank you!!!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!