abs is not a function but is a macro and is used for calculating absolute value of a number.
C programming code for abs:
#include <stdio.h>
#include <math.h>
int main()
{
int n, result;
clrscr();
printf("Enter an integer to calculate it's absolute value\n");
scanf("%d", &n);
result = abs(n);
printf("Absolute value is= %d", result);
getch();
return 0;
}
C programming code for abs:
#include <stdio.h>
#include <math.h>
int main()
{
int n, result;
clrscr();
printf("Enter an integer to calculate it's absolute value\n");
scanf("%d", &n);
result = abs(n);
printf("Absolute value is= %d", result);
getch();
return 0;
}
No comments:
Post a Comment