Answers for "how to get absolute value in c"

C
1

c absolute value of integer

int n = abs(-400);    // n is assigned to 400
Posted by: Guest on November-30-2021
0

c absolute value

#include <stdio.h>
#include <stdlib.h>

int main() 
{
	int a;
	printf("ABSOLUTE VALUEnnNumer: ");
	scanf("%d",&a);
    
	if(a < 0)
	{
		a = a * (-1);
	}
    
	printf("Absolute value: %dnn", a);
    
	system("pause");
}
Posted by: Guest on February-11-2021

Code answers related to "how to get absolute value in c"

Code answers related to "C"

Browse Popular Code Answers by Language