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
Write the following equation in the general form Ax + By + C = 0. <br> 2x + y = 6
katen-ka-za [31]
<span>2x + y = 6
2x + y - 6 = 0

answer is </span>2x + y - 6 = 0

hope that helps
5 0
3 years ago
Sarah,Leah,Haley and Kim bought 5 bottles of water to share among themselves. They divided each bottle of water into 4 equal por
Irina18 [472]

Answer:

Sarah have \frac{5}{4} bottle of water.

Step-by-step explanation:

We are given that,

Total number of bottles = 5

As, each bottle is divided into 4 portions.

The amount of water per person = \frac{1}{4}

Further, Sarah took 1 portion from each bottle and there are 5 bottles.

So, the amount of water Sarah have = \frac{1}{4}\times 5 = \frac{5}{4}

Hence, Sarah have \frac{5}{4} bottle of water.

5 0
2 years ago
Which of these numbers is irrational?
Sidana [21]
<span>Which of these numbers is irrational?
a. square root of 3
b. 0.25
c. 1/5
d. square root of 9

answer
</span><span>a. square root of 3
</span><span>--------------------------------
What is (-7)^5 in expanded form?
a. -7 • -7 • -7 • -7 • -7 
b. -7 • 5
c. (-7) • 7 • (-7) • 7 • (-7) • -7
d. 5 • 5 • 5 • 5 • 5 • 5 • 5

answer

</span><span>a. -7 • -7 • -7 • -7 • -7 </span>
6 0
2 years ago
3 is 12% of what number
AleksAgata [21]


3/12% = 25

<em>Therefore, 3 is 12% of 25.</em>

3 0
3 years ago
Read 2 more answers
Handsome jack is buying a pony mad of diamonds the price of the pony is p dollars and jack also has to pay 25% diamonds pony tax
Leto [7]

Answer:

p=p+25%p

Step-by-step explanation:

hope this was helpful

pls mark Brainliest

so that i can

rank up ;p

5 0
2 years ago
Other questions:
  • Deborah needs to make 16 costumes for the school play. Each costume requires 2 and 1/4 yards of material. How many yards of mate
    15·1 answer
  • I need help ASAP! PLEASEEEE ​
    6·1 answer
  • Which ratios are equivalent to 3/5? 3/4 5/3 5/7 6/10 12/20
    8·2 answers
  • lana is putting a lace trim arount the border of a circular tablecloth. the tablecloth has a diameter of 1.2 meters. to the near
    14·1 answer
  • ‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️‼️PLEASE PLEASE PLEASE HELP!!!!!
    8·2 answers
  • Pleaseee , whic graph represents the inequiality?
    14·1 answer
  • What is the simplest form of this expression?
    15·1 answer
  • In 24 attempts, your classmates made perfectly parallel lines 0 times. Making parallel lines is difficult!
    11·1 answer
  • For the equation, complete the given ordered pairs.<br><br> 3x-y=4<br><br> {0,_} [1,_} {_,4}
    6·1 answer
  • Determine whether the triangles can be proved similar. If they are similar, write a similarity statement. If they are not simila
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!