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
21×9=9×21 what property is used
kvv77 [185]
Hello There =)

Commutative property is used. The commutative property <span>states that two numbers can be multiplied in either order.</span>


5 0
3 years ago
What is the average rate of change for this exponential function for the interval from x = 2 to x = 4?
Hunter-Best [27]

Answer:

The average rate of change over the interval is 120

Step-by-step explanation:

For a function f(x) the average rate of change over an interval [a,b] is given as;

f(b)-f(a)/b-a

in this case, a is 2 and b is 4

f(b) is 256 and f(a) is 16

Substituting these values in the equation for rate of change, we have;

(256-16)/(4-2) = 240/2 = 120

8 0
3 years ago
Please help this is about be getting a 4/4 in my math class now I have 3/4 I want to get 4/4 please help...
r-ruslan [8.4K]

Answer:

Step-by-step explanation:

8 0
3 years ago
PLEASE HELP ITS GEOMETRY :OO
Nezavi [6.7K]

Answer:

center of circle: (0,6)

radius: 4

the point (sqrt17,7) is NOT located on this circle. It is outside of the circle. This circle cuts off at (sqrt15,7), therefor (sqrt17,7) is not included

7 0
3 years ago
Help ME PLSSS 13 points
Greeley [361]

Answer:

6

Step-by-step explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • -4,1,6,11,... Determine whether the sequence is arithmetic , geometric, or neither .
    15·1 answer
  • Nadia brought 4.3 pounds of ham on Tuesday and 1.7 pounds of ham on Wednesday. She spent a total of $41.94.What was the price of
    10·2 answers
  • What 20% tip would you leave on a $100 check
    14·2 answers
  • IS 1/2 BIGGER THAN 1/4
    13·2 answers
  • 34 divided by 2,380.
    14·2 answers
  • Can you help me pls will make brainest
    8·1 answer
  • In a school of 910 pupils, 2/5 are girls and 2/7 of the girls play netball. How many girls play netball??
    15·2 answers
  • Aulo uses an instrument called a densitometer to check that he has the correct ink colour.
    7·1 answer
  • -4(-3n-8)=104<br> A:11<br> B:-6<br> C:10<br> D:6
    10·1 answer
  • What is the surface area?<br><br> 7 ft<br> 7 ft<br> 7 ft
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!