by Dinesh Thakur

In this program user ask to calculate the Absolute value of integer Parameter. User declares some required variables for the storing value in it. Here user use math function for calculate the absolute value. In abs function the negative value is been denied. Then user uses the absolute function for displaying the result on the screen.

Problem Statement:

This is C program where user asks to calculate the Absolute value for the integer parameter.

  1. Declaring the variables.
  2. Using math method.
  3. Display result on the screen.

Here is C source code for calculate the absolute value for integer parameter. Output of this program shown below.


#include <stdio.h>

#include <math.h>
int main ()
{
    int n, m;
    clrscr();
    n = abs( 3 );
    m = abs( -1 );
    printf (" n = %d \n", n);
    printf (" m = %d\n", m);
    getch();
    return 0;
}
Output :
n = 3
m = 1