Calculate the Absolute value of Integer Parameter

by Dinesh Thakur Category: C Programming (Pratical)

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

```

Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Search Content