Program to find the absolute value of given integer using
Conditional Operators

Answer Posted / abdur rab

#include <stdio.h>

int main ( int argc, char* argv [] )
{
int value = -10;
printf ("\n%d", ( value >= 0 ) ? value : ~(value)
+1 );
}

Is This Answer Correct ?    16 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should volatile modifier be used?

558


What library is sizeof in c?

576


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

741


How can I call fortran?

649


What do you mean by keywords in c?

632






how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1510


What is echo in c programming?

562


Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014  Npu university

1605


What is omp_num_threads?

587


Is c still relevant?

648


i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none

650


Are negative numbers true in c?

604


What is the difference between a free-standing and a hosted environment?

647


What is nested structure in c?

616


Is sizeof a keyword in c?

586