លំហាត់​អនុវត្តន៍​អំពី​ក្បួន

សំណួរ

១. តើ​ក្បួន​មាន​សារសំខាន់​យ៉ាងណាដែរ?
២. អ្វី​ទៅ​ជា​ដំណឹង? អ្វី​ទៅ​ជា​ដំណាង?
៣. អ្វី​ទៅ​ជា​កំរង arguments នៅ​ក្នុង​ក្បួន?
៤. តើ​ការស្វែង​រក​វត្ថុ​នៅ​ក្នុង​ក្បួន​ប្រព្រឹត្ត​ទៅ​ដូចម្តេច?

លំហាត់​អនុវត្តន៍
  1. Write a function that takes 2 numbers and returns -1 if the first is less than the second, 1 if the first is greater than the second, and 0 if the numbers are equal.
  2. Write a function that takes the length and width of a rectangle and calculates its area. If 1 parameter is passed to the function, then it calculates the square area.
  3. Write a function that takes time (hours, minutes, seconds) and displays it on the screen in the format "hh:mm:ss". If minutes and/or seconds were not sent when the function was called, then output them as 00.
  4. Write a function that takes hours, minutes, and seconds and returns this time in seconds.
  5. Write a function that takes the number of seconds, converts them into hours, minutes, and seconds and returns them as a string "hh:mm:ss".
  6. Write a function that takes 2 numbers and returns the smaller of them.
  7. Write a function that takes 2 numbers and a sign (+ - * /), calculates it, and returns the result.
  8. Write a function that takes a number and displays a multiplication table for this number. Call the function for all numbers from 2 to 9.
  9. Write a function that takes a date (day, month, year) and returns the date of the next day as a string "dd.mm.yyyy".
  10. Write a function that takes three separate digits and turns them into one number. For example: the digits 1, 4, 9 will become the number 149
  11. Write a function that takes numbers from 1 to 5 and returns their sum.
  12. Write a function that takes numbers from 1 to 5 and returns the larger of them.
  13. Write a function that calculates the difference between dates. The function takes 6 parameters, which describe 2 dates, and returns the result as a string "hh:mm:ss". When completing the task, use the functions from the previous 2 tasks: first convert both dates into seconds, find the difference in seconds, and then convert the difference back to "hh:mm:ss".
  14. Write a function that prints the number passed to it backwards. For example: print out the number 1234 as 4321.
  15. Write a function that calculates the sum of digits of a number. For example: the number is 1357, the sum is 1 + 3 + 5 + 7 = 16.