The use of ABS () function and exp () function in C language _c language

Source: Internet
Author: User
Tags abs

C language ABS () function: Find absolute value (integer)
header file:

#include <stdlib.h>

To define a function:

int abs (int j);

Function Description: ABS () is used to calculate the absolute value of the parameter J, and then return the result.

Return value: Returns the absolute result of the parameter J.

Example

#ingclude <stdlib.h>
Main () {
  int ansert;
  Answer = ABS ( -12);
  printf ("|-12| =%d\n ", answer);
}

Perform

|-12| = 12

C language exp () function: The second power function of E (the x-th square value at the end of E)
header file:

 #include <math.h>

EXP () is used to calculate the X-square value, the ex value, at the base of E, and then return the result. Its prototype is:

 Double exp (double x);

return value returns the X-square calculation of E.

Note that when compiling with GCC, please join-LM.

"Instance" calculates the value of the 10-second side of E.

#include <math.h>
Main () {
 double answer;
 Answer = exp (ten);
 printf ("e^10 =%f\n", answer);
}

Run Result:

E^10 = 22026.465795

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.