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
In a family with 2 children, excluding multiple births, what is the probability of having a boy and a girl in any order?
ioda
50% because it can either girl or boy first. I hope i helped
4 0
3 years ago
Read 2 more answers
How long does a missed payment on a mortgage stay on a consumer’s credit report?
Nataly_w [17]

Answer: C) 7 years

There's not much explanation other than I did an online search for the answer. Many sources I'm finding are saying "up to 7 years", which means that is the longest it will stay on the credit report.

7 0
3 years ago
Five dogs were running in a race. Bandit completed the race in 10 seconds after Sergeant and 30 seconds before Sally. Smokey com
Klio2033 [76]

Answer:

Sergeant, Tobie, Bandit, Smokey, Sally

Step-by-step explanation:

6 0
2 years ago
5. The largest mosaic in the world is on the walls of the central library of the
Cloud [144]

Answer:

<h3> 63.25m</h3>

Step-by-step explanation:

The area of the square wall = L² where;

L is the length of the wall.

Given

Area of the mosaic = 4000m²

Substitute into the formula and get L

4000 = L²

Square root both sides

√4000 = √L²

√4000 = L

Rearrange

L = √4000

L = 63.25m (to the nearest hundredth)

<h3>Hence the length to the nearest hundredth is 63.25m</h3>
7 0
3 years ago
Please help!!! Solve for the m
hjlf

Answer:

36°

Step-by-step explanation:

m\angle C =sin^{-1}\frac{17}{29}\\m\angle C =35.888297553\degree\\m\angle C =36\degree

4 0
3 years ago
Other questions:
  • What is the next operation required to isolate the variable?
    11·1 answer
  • Lines a and b are parallel and lines e and f are parallel.
    6·2 answers
  • Fill in the blank. ASAP . . . . .
    9·1 answer
  • Write an inequality, in slope-intercept form, for the graph below. to get you started y&gt;=​
    15·1 answer
  • Triangle ABC is an obtuse triangle with the obtuse angle at vertex B. Angle A must be
    9·1 answer
  • Which of the following theorems verifies that WVU = RST?
    10·1 answer
  • 0.1/2 as a decimal <br> plz help
    6·1 answer
  • When adding and subtracting numbers do you add and subtract the denominator​
    5·2 answers
  • Find The Inverse Of f(x) and its domain​
    14·1 answer
  • find the radius of a circle with a circumference of 59 yards round your answer to the nearest hundredth of a yard
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!