Computes the square root of the complex number z with a branch cut along the negative real axis. Write a C, C program to print square of a number. We have to write a code in which our program will take an input number and print it's square. Similar programming questions for practice. Calculate cube of a number Find sum of first n odd numbers Program to check perfect square of a number C Program to Print Square of a Number. Compute square root. Returns the square root of x. Header tgmath.h provides a type-generic macro version of this function. This function is overloaded in and (see complex sqrt and valarray sqrt).
I have created a program without using sqrt and the pwr function but instead have used logs and exponent.
The professor said that math.h is not allowed. I am aware that this library is important for computation, but how do I compute the math without using the math.h?
Would I need to create my library if so how?
- 12 Contributors
- forum 14 Replies
- 907 Views
- 4 Years Discussion Span
- commentLatest Postby mikrosfoititisLatest Post
Bench212
That depends what the program is. I doubt that he's asking you to rewrite the sqrt, log and pow functions from math.h (Unless your course is a mathematics one).
if you post a description of your problem, and the code from your current solution, there might be another way to do it.
In the C Programming Language, the sqrt function returns the square root of x.
Syntax
The syntax for the sqrt function in the C Language is:
Parameters or Arguments
- x
- A value used when calculating the square root of x.
Returns
The sqrt function returns the square root of x. If x is negative, the sqrt function will return a domain error.
Required Header
In the C Language, the required header for the sqrt function is:
Applies To
In the C Language, the sqrt function can be used in the following versions:
Code For Square Root In Dev C 5
- ANSI/ISO 9899-1990
sqrt Example
Alt Code For Square Root
When compiled and run, this application will output:
Similar Functions
Other C functions that are similar to the sqrt function: