Math functions in C program

abs()Absolute value of input number
ceil()Highest integer lower than the input data
floor()Highest integer lower than the input data
hypot() hypotenuse of two input numbers
log() log value with base e of a number
log10() log value with base 10 of a number
pow() x to the power y of two input numbers
fmod()remainder after division of numbers
round()Rounding to nearest integer
sqrt()Square root of a given number
trunc()Truncation of number
sin(), cos() , tan()sin(), cos() & tan() value
sinh(), cosh() , tanh()sinh(), cosh() & tanh() value

Practice Questions

  1. Take one input integer ( both positive and negative ) and print the absolute value of it.
  2. Take one float input and display the absolute value of it.
  3. Take one float input value and display the ceil() value of the same.
  4. Find out the ceil() value and floor() value for the following input numbers
    4.6,4.5.4,3,-2.3-2.4,-2.5,-2.6,4.0, 4.9
    Note : All the above functions takes one input.
  5. Print the output of hypot(x,y) where x, y are integer variables.
  6. Print the output of hypotf(x,y) where x, y are float variables.
  7. Print the output of hypotl(x,y) where x, y are long variables.
  8. Print the value of log(x) where x is an integer or a float or a long variable.
  9. Print the value of log10(x) where x is an integer or a float or a long variable.
  10. Print the value of pow(x,y) where x and y are integer or float or a long variables.
  11. Declare float variables with these values
    3.456,3.567,4.678, -2.456,-2.567,-2.678
    Use math function round() and check the outputs .
  12. What is the sqrt(625) output
  13. What is the output of trunc(13.123456)
  14. Declare value of PI as 3.1141592 , then find out the value of sin(PI/2), cos(PI/2), tan(PI/2)
  15. Find the similar values for PI/3, PI/4
  16. In place of sin() use shinh() and check the above values.
C Tutorials


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 All rights reserved worldwide Privacy Policy Disclaimer