The source code to demonstrate the ceil() function is given below. The given program is compiled and executed successfully.
# Ruby program to demonstrate the
# ceil() function
num1 = 10.23;
num2 = -20.53;
print "Num1: " ,num1.ceil();
print "\nNum2: ",num2.ceil();
Output:
Num1: 11
Num2: -20
Explanation:
In the above program, we created two variables num1, num2 initialized with 10.23, -20.53 respectively. Then we round off the decimal value of given numbers using ceil() function and print the result.
Program/Source Code:
The source code to demonstrate the ceil() function is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created two variables num1, num2 initialized with 10.23, -20.53 respectively. Then we round off the decimal value of given numbers using ceil() function and print the result.
need an explanation for this answer? contact us directly to get an explanation for this answer