VOOZH about

URL: https://www.geeksforgeeks.org/cpp/norm-function-in-cpp-with-examples/

⇱ norm() function in C++ with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

norm() function in C++ with Examples

Last Updated : 14 Mar, 2023

The norm() function is defined in the complex header file. This function is used to return the squared magnitude of the complex number z. Syntax:

template<class T> T norm (const complex<T>& z);

Parameter:

  • z: It represents the given complex number.

Return: It returns the squared magnitude of the complex number. 

Time Complexity: O(1)

Auxiliary Space: O(1)

Below programs illustrate the above function:- 

Example 1:- 

Output:
The norm of (5,12) is 169

Example 2:- 

Output:
The norm of (4,3) is 25
Comment
Article Tags: