Square Root Function In Dev C++
- Square Root Function In Dev C 5
- Square Root Function In Dev C System
- Square Root Function In Dev C Pdf
- Square Root Function In Dev C Download
Nov 25, 2012 Check out for more free engineering tutorials and math lessons! C Programming Tutorial: Square root and power functions Please. Returns the square root of x. Header provides a type-generic macro version of this function. This function is overloaded in and (see complex sqrt and valarray sqrt ). However, teachers at universities don't like to let the things easy for students, that's why in programming classes you may need to find a way to find the square root of a number without using this library in C! As homeworks or tasks aren't optional, we'll show you how you can easily achieve this goal without using the sqrt function in C.
- The C Standard Library
- C Standard Library Resources
- C Programming Resources
- Selected Reading
The math.h header defines various mathematical functions and one macro. All the functions available in this library take double as an argument and return double as the result.
Library Macros
There is only one macro defined in this library −
Sr.No. | Macro & Description |
---|---|
1 | HUGE_VAL This macro is used when the result of a function may not be representable as a floating point number. If magnitude of the correct result is too large to be represented, the function sets errno to ERANGE to indicate a range error, and returns a particular, very large value named by the macro HUGE_VAL or its negation (- HUGE_VAL). If the magnitude of the result is too small, a value of zero is returned instead. In this case, errno might or might not be set to ERANGE. |
Library Functions
Following are the functions defined in the header math.h −
Square Root Function In Dev C 5
Sr.No. | Function & Description |
---|---|
1 | double acos(double x) Returns the arc cosine of x in radians. |
2 | double asin(double x) Returns the arc sine of x in radians. |
3 | double atan(double x) Returns the arc tangent of x in radians. |
4 | double atan2(double y, double x) Returns the arc tangent in radians of y/x based on the signs of both values to determine the correct quadrant. |
5 | double cos(double x) Returns the cosine of a radian angle x. |
6 | double cosh(double x) Returns the hyperbolic cosine of x. |
7 | double sin(double x) Returns the sine of a radian angle x. |
8 | double sinh(double x) Returns the hyperbolic sine of x. |
9 | double tanh(double x) Returns the hyperbolic tangent of x. |
10 | double exp(double x) Returns the value of e raised to the xth power. |
11 | double frexp(double x, int *exponent) The returned value is the mantissa and the integer pointed to by exponent is the exponent. The resultant value is x = mantissa * 2 ^ exponent. |
12 | double ldexp(double x, int exponent) Returns x multiplied by 2 raised to the power of exponent. |
13 | double log(double x) Returns the natural logarithm (base-e logarithm) of x. |
14 | double log10(double x) Returns the common logarithm (base-10 logarithm) of x. |
15 | double modf(double x, double *integer) The returned value is the fraction component (part after the decimal), and sets integer to the integer component. |
16 | double pow(double x, double y) Returns x raised to the power of y. |
17 | double sqrt(double x) Returns the square root of x. |
18 | double ceil(double x) Returns the smallest integer value greater than or equal to x. |
19 | double fabs(double x) Returns the absolute value of x. |
20 | double floor(double x) Returns the largest integer value less than or equal to x. |
21 | double fmod(double x, double y) Returns the remainder of x divided by y. |
In this Example we will learn how to find the square root of a given number using C++. Dev c does not name a type pe error.
Square Root Function In Dev C System
In the first example we are going to use std::pow function to calculate the square root.
2 4 6 8 10 12 14 16 | #include <cmath> intmain() intnumber,result; cin>>number; cout<<'nSqure of '<<number<<' is: '<<result<<endl; OUTPUT Squre of 9 is: 3 |
Now In the next example we will learn how to find the square root of a given number using std::sqrt function.
2 4 6 8 10 12 14 16 18 | #include <cmath> intmain() intnumber,result; cin>>number; cout<<'nSqure of '<<number<<' is: '<<result; OUTPUT Squre of 36 is: 6 */ |
- C++ Simple Programs And Examples
- Formula Based Programs
Square Root Function In Dev C Pdf
- String Based Programs
- Array Based Programs
- Print Any Patterns
- C++ Conversion
- C++ Sorting algorithms & Techniques
Square Root Function In Dev C Download
- C++ Handling Files