From 11c4e28710508b9cb196525c920648e91725db68 Mon Sep 17 00:00:00 2001 From: Vasily Guzov Date: Thu, 3 Oct 2024 13:00:35 +0300 Subject: [PATCH] [8kyu][array][fundamentals] conditions https://www.codewars.com/kata/55f9b48403f6b87a7c0000bd 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. --- lib/paperwork.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 lib/paperwork.ts diff --git a/lib/paperwork.ts b/lib/paperwork.ts new file mode 100644 index 0000000..7687e37 --- /dev/null +++ b/lib/paperwork.ts @@ -0,0 +1,6 @@ +export function paperwork(n: number, m: number): number { + if (n < 0 || m < 0) return 0; + return n * m; +} + +console.log(paperwork(45, 29))