Ruby Program to Get the Predecessor of an Integer Number Using Library Function

Ruby program to get the predecessor of an integer number using library function

# Ruby program to get the predecessor of an 
# integer number using library function

num1 = 20;
num2 = -23

print "Predecessor of num1: ",num1.pred(),"\n";
print "Predecessor of num2: ",num2.pred(),"\n";
Predecessor of num1: 19
Predecessor of num2: -24
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment