# find modulus of the complex number in python by R4R Team

- abs() is python function which are able to find the modulus of the complex number.

Syntax-

abs(num)

- here num is a complex number.
- and it return the modulus of the complex number.

Example-

complex number is 3+4j
modulus is 5.0

complex number is 1+0j
modulus is 1.0

program-

print("Enter real part")
r=int(input())
print("Enter imaginary part")
i=int(input())
n=complex(r,i)

#first way to find the modulus
mod=pow(n.real**2+n.imag**2,1/2)
print("Modulus is ",mod)

#second way
mod=abs(n)
print("Modulus is ",mod)

output-

Enter real part
3
Enter imaginary part
4
Modulus is 5.0
Modulus is 5.0

Enter real part
1
Enter imaginary part
0
Modulus is 1.0
Modulus is 1.0

Enter real part
5
Enter imaginary part
10
Modulus is 11.180339887498949
Modulus is 11.180339887498949

-In this program, we take input of real and imaginary part of the complex number, then by pow() function adn abs() function we find the modulus of the complex number.