Ruby User-defined Functions Programs

This section contains Ruby user-defined functions programs, practice these Ruby programs to learn the concept of user-defined functions/methods, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the Ruby user-defined functions programs.

List of Ruby User-defined Functions Programs

  1. Ruby program to create a user-defined function without argument and without a return value
  2. Ruby program to create a user-defined function with arguments but without a return value
  3. Ruby program to create a user-defined function without argument but return a value
  4. Ruby program to create a user-defined function with arguments and a return value
  5. Ruby program to pass an array to the user-defined function
  6. Ruby program to return an array from the user-defined function
  7. Ruby program to pass a string to the user-defined function
  8. Ruby program to return a string from the user-defined function
  9. Ruby program to return multiple values from the user-defined function
  10. Ruby program to create a simple recursive function
  11. Ruby program to calculate the factorial of given number using recursion
  12. Ruby program to print the Fibonacci series using recursion
  13. Ruby program to calculate the power of a given number using recursion
  14. Ruby program to count the digits of a given number using recursion
  15. Ruby program to find the sum of the digits of a given number using recursion
  16. Ruby program to find the reverse of a given number using recursion
  17. Ruby program to find the given number is PRIME or not using recursion
  18. Ruby program to find the LCM of two given numbers using recursion
  19. Ruby program to find the GCD of two given numbers using recursion
  20. Ruby program to find the HCF of two given numbers using recursion
  21. Ruby program to calculate the product of two given numbers using recursion
  22. Ruby program to convert the decimal number to binary using recursion
  23. Ruby program to convert the Binary number to Gray code using recursion



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.