Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 636 Bytes

beginner_series_№_1_school_paperwork.md

File metadata and controls

30 lines (24 loc) · 636 Bytes

Description

Your classmates asked you to copy some paperwork for them. You know that there are 'n' classmates and the paperwork has 'm' pages.

Your task is to calculate how many blank pages do you need. If n < 0 or m < 0 return 0.

Example:

n= 5, m=5: 25
n=-5, m=5:  0

Waiting for translations and Feedback! Thanks!

My Solution

def paperwork(n, m)
  return 0 if n < 0 || m < 0
  n * m
end

Better/Alternative solution from Codewars

def paperwork(n, m)
  n >= 0 && m >= 0 ? n * m : 0
end