Ruby Basic Programs
- Ruby program to print Hello World!
- Ruby program to add two integer numbers
- Ruby program to find the area of the rectangle
- Ruby program to check leap year
- Ruby program to print power of a number
- Ruby program to print Fibonacci series
- Ruby program to check whether the given number is prime or not
- Ruby program to find factorial of a given number
- Ruby program to check whether a variable is defined or not
- Ruby program to calculate the sum of all even numbers
- Ruby program to calculate the sum of all odd numbers up to N
- Ruby program to count the number of digits in a number
- Ruby program to print multiplication table of a number
- Ruby program to read a floating-point number from the user
- Ruby program to calculate the area of Parallelogram
- Ruby program to calculate the area of Cube
- Ruby program to calculate the volume of Cube
- Ruby program to calculate the volume and area of the Cylinder
- Ruby program to calculate the volume, diagonal, and area of Cuboids
- Ruby program to calculate the volume and area of Cone
- Ruby program to calculate the volume and area of Sphere
- Ruby program to read coordinate points and determine its quadrant
- Ruby program to extract the last two digits from the given year
- Ruby program to read the height of a person and the print person is taller, dwarf, or average height person
- Ruby program to find the power of a number without using library function
- Ruby program to divide a number from another number without using the division \'/\' operator
- Ruby program to check the given number is EVEN or ODD using ternary operator
- Ruby program to check the given number is POSITIVE or NEGATIVE using the ternary operator
- Ruby program to check a person is eligible for voting or not using the ternary operator
- Ruby program to find the largest number between two numbers using ternary operator
- Ruby program to find the largest number among three numbers using ternary operator
- Ruby program to find the division of students based on percentage using ternary operator
- Ruby program to demonstrate the bitwise left-shift (<<) operator
- Ruby program to demonstrate the bitwise right-shift (>>) operator
- Ruby program to demonstrate the bitwise AND (&) operator
- Ruby program to demonstrate the bitwise OR (|) operator
- Ruby program to demonstrate the bitwise XOR (^) operator
- Ruby program to swap two numbers using the Bitwise XOR (^) operator
- Ruby program to set the specific bit using the bitwise operator
- Ruby program to clear the specific bit using the bitwise operator
- Ruby program to find the 1\'s complement of the given number
- Ruby program to demonstrate the Boolean NOT (!) operator
- Ruby program to demonstrate the exponential operator (**)
- Ruby program to demonstrate the arithmetic operators
- Ruby program to demonstrate the logical operators
- Ruby program to read an integer number from the user
- Ruby program to find the area of the circle
- Ruby program to calculate the perimeter of the circle
- Ruby program to multiply two numbers using the plus (+) operator
- Ruby program to subtract a number without using the minus (-) operator
- Ruby program to find the remainder without using the modulus (%) operator
- Ruby program to calculate the Highest Common Factor
- Ruby program to calculate the Greatest Common Divisor
- Ruby program to calculate the Lowest Common Multiple
- Ruby program to calculate the area of Trapezium
- Ruby program to calculate the area of the rhombus
- Ruby program to calculate the square root of the given number
- Ruby program to calculate the cube root of the given number
- Ruby program to calculate the base 2 logarithm of the given value
- Ruby program to calculate the base 10 logarithm of the given value
- Ruby program to calculate the logarithm of a given number based on a given base
- Ruby program to calculate the logarithm gamma of the given number
- Ruby program to find the fraction and exponent of a number
- Ruby program to calculate the value from the given fraction and exponent
- Ruby program to find the hypotenuse of a right-angled triangle with sides l and b
- Ruby program to find the value of e^value using exp() function
- Ruby program to demonstrate the Math.erf() function
- Ruby program to find the sine of given radian value
- Ruby program to find the cosine of given radian value
- Ruby program to find the tangent of given radian value
- Ruby program to find the hyperbolic sine of given radian value
- Ruby program to find the hyperbolic cosine of given radian value
- Ruby program to find the hyperbolic tangent of given radian value
- Ruby program to find the arcsine of the given value
- Ruby program to find the arccosine of the given value
- Ruby program to find the arctangent of the given value
- Ruby program to find the hyperbolic arcsine of the given value
- Ruby program to find the hyperbolic arccosine of the given value
- Ruby program to find the hyperbolic arctangent of the given value
- Ruby program to convert the string into an integer
- Ruby program to convert the string into a floating-point number
- Ruby program to convert a number into a complex number
- Ruby program to initialize and print a complex number
- Ruby program to convert an integer number into a string
- Ruby program to convert a number into a rational number
- Ruby program to find the absolute value of the given number
- Ruby program to check the given number is an integer or not
- Ruby program to print the absolute value of Complex numbers
- Ruby program to get the imaginary part of the given complex number
- Ruby program to create Complex numbers from given imaginary parts
- Ruby program to demonstrate the floor() function
- Ruby program to demonstrate the ceil() function
- Ruby program to print character of given ASCII value
- Ruby program to print ASCII value of given character
- Ruby program to demonstrate the downto() function
- Ruby program to demonstrate the upto() function
- Ruby program to check the given number is an EVEN number using library function
- Ruby program to find the GCD using library function
- Ruby program to find the LCM using library function
- Ruby program to perform integer division of two numbers using div() function
- Ruby program to perform float division of two numbers using the fdiv() function
- Ruby program to check a number is zero or not using the zero?() function
- Ruby program to demonstrate the inspect() function
- Ruby program to get the numerator from a rational number
- Ruby program to demonstrate the <=> operator
- Ruby program to demonstrate the phase() function
- Ruby program to check a given number is finite or not
- Ruby program to get the real part from a Complex number
- Ruby program to get the division and remainder using library function
- Ruby program to check the given number is an odd number using library function
- Ruby program to get the predecessor of an integer number using library function
- Ruby program to get the successor of an integer number using library function
- Ruby program to get the denominator from a rational number
- Ruby program to demonstrate the coerce() function
- Ruby program to demonstrate the arg() function
- Ruby program to demonstrate the abs2() function
- Ruby program to get the magnitude of the given number
- Ruby program to get the remainder of float numbers using library function
- Ruby program to compare numbers and strings using library function
- Ruby program to get total bits required for the given number using library function
- Ruby program to get the GCD and LCM using gcdlcm() library function
- Ruby program to demonstrate the next() function
- Ruby program to demonstrate the range (..) operator
Ruby code to print a Fibonacci series
Output
Method 2:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer