MATH FUNCTION IN C

Maha


Math Function In C

  • C Programming allows us to perform mathematical operations task on numbers. through the functions defined in <math.h> header file. 
  • The <math.h> header file contains various methods for performing mathematical operations such as sqrt(), pow(), ceil(), floor() etc.

Syntax:

#include<stdio.h>
#include <math.h>


Program:


  #include <math.h>
  int main(){
  int n,x;
  printf("Enter an integer number: ");
  scanf("%d",&n);
  x=abs(n);
  printf("Absolute value of %d is %d",n,x);
  return 0;
  }


Output:


  Enter an integer number:





More topic in C

Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send