Ruby program to get the imaginary part of the given complex number

bookmark

num1 = Complex(200,10);
num2 = Complex(-1, 4);
num3 = Complex(23,45);

print "Num1: "  ,num1.imaginary();
print "\nNum2: ",num2.imaginary();
print "\nNum3: ",num3.imaginary();

 


Output:

Num1: 10
Num2: 4
Num3: 45