Ruby Program to Create Complex Numbers From Given Imaginary Parts

You are currently viewing Ruby Program to Create Complex Numbers From Given Imaginary Parts

Ruby program to create Complex numbers from given imaginary parts

# Ruby program to create Complex number 
# from given imaginary part

num1 =  10;
num2 = -20;
num3 =  30;

print "Num1: "  ,num1.i();
print "\nNum2: ",num2.i();
print "\nNum3: ",num3.i();
Num1: 0+10i
Num2: 0-20i
Num3: 0+30i

Ranjith Kumar

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 Reply