CSE101-math lib functions Lec#13.pptx - CSE101-Lec#13 Math...

This preview shows page 1 - 6 out of 15 pages.

©LPU CSE101 C Programming Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU CSE101-Lec#13 Math Library functions
Image of page 1
©LPU CSE101 C Programming C Standard Library Every implementation of C comes with a standard library of predefined functions. Note that, in programming, a library is a collection of functions . The functions that are common to all versions of C are known as the C Standard Library .
Image of page 2
©LPU CSE101 C Programming Math Library Functions Math library functions perform common mathematical calculations #include <math.h> Format for calling maths functions functionName( argument ); If multiple arguments, use comma-separated list Example: printf( "%.2f", sqrt( 900.0 ) ); Calls function sqrt , which returns the square root of its argument All math functions return data type double Arguments may be constants, variables, or expressions
Image of page 3
©LPU CSE101 C Programming Math Library Functions
Image of page 4
©LPU CSE101 C Programming Math Library Functions: pow() · The power function, pow(x,y) , calculates x y
Image of page 5
Image of page 6

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture