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

Explain what is the purpose of "extern" keyword in a function declaration?

623


What are the various types of control structures in programming?

630


What is sorting in c plus plus?

565


What is NULL pointer?

677


List the variables are used for writing doubly linked list program.

1625






What does the c in ctime mean?

571


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

660


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

631


What does the format %10.2 mean when included in a printf statement?

1091


What is c standard library?

692


What is the scope of global variable in c?

558


What does 3 mean in texting?

617


How can I generate floating-point random numbers?

609


What is action and transformation in spark?

598


What is difference between Structure and Unions?

640