+ 1

How to use absolute function in c language

General

11th Jul 2020, 1:26 PM
Rishabh Giri
Rishabh Giri - avatar
3 ответов
+ 3
#include <stdio.h> #include <stdlib.h> int main(){ int a=-7; int b=abs(a); printf("%d",b); } //Prints 7
11th Jul 2020, 1:30 PM
Nikhil Maroju
Nikhil Maroju - avatar
0
Rishabh Giri absolute value of a value means changing the -ve value to +ve value and +ve remains +ve . and since it is related to maths. it is made available in math.h header file the syntax of abs() be like this int abs(int a) that means it takes a value and returns a positive integer b = abs(-6)
11th Jul 2020, 1:43 PM
uday kiran
uday kiran - avatar