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

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int m;
printf("enter the value of m:");
scanf("%d",&m);
(m>=0?printf("%d",m):printf("%d",-(-m)));
getch();
}

Is This Answer Correct ?    37 Yes 38 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3127


What is assignment operator?

626


What is wild pointer in c?

609


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3249


Why is void main used?

621






Is it better to bitshift a value than to multiply by 2?

661


Do variables need to be initialized?

623


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

1481


How can I trap or ignore keyboard interrupts like control-c?

620


Why can’t we compare structures?

815


What are valid signatures for the Main function?

701


What are the 3 types of structures?

574


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1452


List out few of the applications that make use of Multilinked Structures?

1305


What is function prototype in c with example?

580