536 views
0 votes
0 votes
what is function in c pragramming  to take mod of number in c ie. |-15|=15

2 Answers

Best answer
8 votes
8 votes

abs function

SYNOPSIS
        
#include <stdlib.h>
int abs(int j);
long int labs(long int j);
long long int llabs(long long int j);
selected by
4 votes
4 votes

You can always design your own, 

int mod(int num){
    if(num<0) return -num;
    else return num;
}

Related questions

0 votes
0 votes
1 answer
2
Shijith M asked Jul 9, 2018
815 views
Consider a C Program situation like this, main() { float a=2.23564; printf("%d",a); }Then what will be the output??please help me..
0 votes
0 votes
2 answers
3
0 votes
0 votes
1 answer
4
Nitesh Choudhary asked Apr 16, 2017
492 views
There are many questions related to size of pointer and it's also depend on machine so anyone tell me source of reading pointer. (for Gate)