Return absolute value of integer parameter: how to use abs : Absolute Value « Math « C / ANSI-C






Return absolute value of integer parameter: how to use abs


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

int main ()
{
  int n, m;
  n = abs( 3 );
  m = abs( -1 );

  printf (" n = %d \n", n);
  printf (" m = %d\n", m);

  return 0;
}



           
       








Related examples in the same category

1.How to get absolute value for float
2.Get absolute value of long integer parameter: how to use labs
3.Return absolute value of floating-point: fabs Return absolute value of floating-point: fabs