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
Brianna was making a garden. Half of the garden was 2/5. How much was the other half of the garden?
xxMikexx [17]

Answer: 3/5


Step-by-step explanation: 5/5 - 2/5 =3/5

PLZ Give brainliest





4 0
3 years ago
Read 2 more answers
How do you set up and solve these inequalities-only 16-20
xxMikexx [17]
Sorry I'm late, here are the equations, just solve for x! Treat the inequalities like an = sign and solve!!

7 0
3 years ago
Which expression shows how to correctly determine the speed in meters per second?
inn [45]

Answer:

B.?

Step-by-step explanation:

i just took the test and i think B.18 seconds ÷ 402 meters

is the right answer plz tell lily~chan if shes wrong!

3 0
3 years ago
3/8+5/16 in lowest terms
Salsk061 [2.6K]
3/8+5/16

=3/8+5/16

=6/16+5/16

=6+5/16

=11/16

(Decimal: 0.6875)

6 0
3 years ago
Jordan starts his day by doing his exercises. Jordan jumps rope for 10 minutes and lifts weights for 30 minutes. Jordan runs 10
romanna [79]

Answer:

35

Step-by-step explanation:

0.25 x 140 = 35

8 0
3 years ago
Other questions:
  • the monthly rents for five apartments advertised in a newspaper were $650,$650,$740,$1650, and $820. use the mean, median, and m
    9·1 answer
  • Lee washes the outsides of houses. It takes him 40 minutes to power wash a one-story home, and he uses 180 gallons of water. Pow
    12·1 answer
  • If you need 10.5 trees for 5 cabins,then how many do you need for 3 cabins?
    15·1 answer
  • A town received 1/2 inch of rain in 1 1/3 hours.what was the average rate of rainfall for the town in inches per hour?
    9·1 answer
  • What term is described as a seamount with a flattened top
    7·2 answers
  • Find S? Please help, thank you :)
    7·1 answer
  • Add me on discord: StarLight#4831<br><br> dont answer if u dont have discord
    6·2 answers
  • Ellie walked three and ninety five thousands kilometers.What is the standard form of this decimal ​
    12·1 answer
  • write a equation for the table below representing the relationship between the number of hours and earring dollars
    8·2 answers
  • You loan your brother $300 and charge him 2% simple annual interest. He promises to
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!