Ruby Basic Programs

This section contains the basic programs of Rust Programming Language like printing text, reading values, programs based on the basic operators, etc.

Practice these Ruby Basic Programs to learn the basic concepts of Rust, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the Ruby Basic Programs.

List of Ruby Basic Programs

  1. Ruby program to print Hello World!
  2. Ruby program to add two integer numbers
  3. Ruby program to find the area of the rectangle
  4. Ruby program to check leap year
  5. Ruby program to print power of a number
  6. Ruby program to print Fibonacci series
  7. Ruby program to check whether the given number is prime or not
  8. Ruby program to find factorial of a given number
  9. Ruby program to check whether a variable is defined or not
  10. Ruby program to calculate the sum of all even numbers
  11. Ruby program to calculate the sum of all odd numbers up to N
  12. Ruby program to count the number of digits in a number
  13. Ruby program to print multiplication table of a number
  14. Ruby program to read a floating-point number from the user
  15. Ruby program to calculate the area of Parallelogram
  16. Ruby program to calculate the area of Cube
  17. Ruby program to calculate the volume of Cube
  18. Ruby program to calculate the volume and area of the Cylinder
  19. Ruby program to calculate the volume, diagonal, and area of Cuboids
  20. Ruby program to calculate the volume and area of Cone
  21. Ruby program to calculate the volume and area of Sphere
  22. Ruby program to read coordinate points and determine its quadrant
  23. Ruby program to extract the last two digits from the given year
  24. Ruby program to read the height of a person and the print person is taller, dwarf, or average height person
  25. Ruby program to find the power of a number without using library function
  26. Ruby program to divide a number from another number without using the division '/' operator
  27. Ruby program to check the given number is EVEN or ODD using ternary operator
  28. Ruby program to check the given number is POSITIVE or NEGATIVE using the ternary operator
  29. Ruby program to check a person is eligible for voting or not using the ternary operator
  30. Ruby program to find the largest number between two numbers using ternary operator
  31. Ruby program to find the largest number among three numbers using ternary operator
  32. Ruby program to find the division of students based on percentage using ternary operator
  33. Ruby program to demonstrate the bitwise left-shift (<<) operator
  34. Ruby program to demonstrate the bitwise right-shift (>>) operator
  35. Ruby program to demonstrate the bitwise AND (&) operator
  36. Ruby program to demonstrate the bitwise OR (|) operator
  37. Ruby program to demonstrate the bitwise XOR (^) operator
  38. Ruby program to swap two numbers using the Bitwise XOR (^) operator
  39. Ruby program to set the specific bit using the bitwise operator
  40. Ruby program to clear the specific bit using the bitwise operator
  41. Ruby program to find the 1's complement of the given number
  42. Ruby program to demonstrate the Boolean NOT (!) operator
  43. Ruby program to demonstrate the exponential operator (**)
  44. Ruby program to demonstrate the arithmetic operators
  45. Ruby program to demonstrate the logical operators
  46. Ruby program to read an integer number from the user
  47. Ruby program to find the area of the circle
  48. Ruby program to calculate the perimeter of the circle
  49. Ruby program to multiply two numbers using the plus (+) operator
  50. Ruby program to subtract the numbers without using the minus (-) operator
  51. Ruby program to find the remainder without using the modulus (%) operator
  52. Ruby program to calculate the Highest Common Factor
  53. Ruby program to calculate the Greatest Common Divisor
  54. Ruby program to calculate the Lowest Common Multiple
  55. Ruby program to calculate the area of Trapezium
  56. Ruby program to calculate the area of the rhombus
  57. Ruby program to calculate the square root of the given number
  58. Ruby program to calculate the cube root of the given number
  59. Ruby program to calculate the base 2 logarithm of the given value
  60. Ruby program to calculate the base 10 logarithm of the given value
  61. Ruby program to calculate the logarithm of a given number based on a given base
  62. Ruby program to calculate the logarithm gamma of the given number
  63. Ruby program to find the fraction and exponent of a number
  64. Ruby program to calculate the value from the given fraction and exponent
  65. Ruby program to find the hypotenuse of a right-angled triangle with sides l and b
  66. Ruby program to find the value of e^value using exp() function
  67. Ruby program to demonstrate the Math.erf() function
  68. Ruby program to find the sine of given radian value
  69. Ruby program to find the cosine of given radian value
  70. Ruby program to find the tangent of given radian value
  71. Ruby program to find the hyperbolic sine of given radian value
  72. Ruby program to find the hyperbolic cosine of given radian value
  73. Ruby program to find the hyperbolic tangent of given radian value
  74. Ruby program to find the arcsine of the given value
  75. Ruby program to find the arccosine of the given value
  76. Ruby program to find the arctangent of the given value
  77. Ruby program to find the hyperbolic arcsine of the given value
  78. Ruby program to find the hyperbolic arccosine of the given value
  79. Ruby program to find the hyperbolic arctangent of the given value
  80. Ruby program to convert the string into an integer
  81. Ruby program to convert the string into a floating-point number
  82. Ruby program to convert a number into a complex number
  83. Ruby program to initialize and print a complex number
  84. Ruby program to convert an integer number into a string
  85. Ruby program to convert a number into a rational number
  86. Ruby program to find the absolute value of the given number
  87. Ruby program to check the given number is an integer or not
  88. Ruby program to print the absolute value of Complex numbers
  89. Ruby program to get the imaginary part of the given complex number
  90. Ruby program to create Complex numbers from given imaginary parts
  91. Ruby program to demonstrate the floor() function
  92. Ruby program to demonstrate the ceil() function
  93. Ruby program to print character of given ASCII value
  94. Ruby program to print ASCII value of given character
  95. Ruby program to demonstrate the downto() function
  96. Ruby program to demonstrate the upto() function
  97. Ruby program to check the given number is an EVEN number using library function
  98. Ruby program to find the GCD using library function
  99. Ruby program to find the LCM using library function
  100. Ruby program to perform integer division of two numbers using div() function
  101. Ruby program to perform float division of two numbers using the fdiv() function
  102. Ruby program to check a number is zero or not using the zero?() function
  103. Ruby program to demonstrate the inspect() function
  104. Ruby program to get the numerator from a rational number
  105. Ruby program to demonstrate the <=> operator
  106. Ruby program to demonstrate the phase() function
  107. Ruby program to check a given number is finite or not
  108. Ruby program to get the real part from a Complex number
  109. Ruby program to get the division and remainder using library function
  110. Ruby program to check the given number is an odd number using library function
  111. Ruby program to get the predecessor of an integer number using library function
  112. Ruby program to get the successor of an integer number using library function
  113. Ruby program to get the denominator from a rational number
  114. Ruby program to demonstrate the coerce() function
  115. Ruby program to demonstrate the arg() function
  116. Ruby program to demonstrate the abs2() function
  117. Ruby program to get the magnitude of the given number
  118. Ruby program to get the remainder of float numbers using library function
  119. Ruby program to compare numbers and strings using library function
  120. Ruby program to get total bits required for the given number using library function
  121. Ruby program to get the GCD and LCM using gcdlcm() library function
  122. Ruby program to demonstrate the next() function
  123. Ruby program to demonstrate the range (..) operator



Comments and Discussions!

Load comments ↻





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