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

Answer Posted / ravi vishwakarma

#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 ?    38 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to compare array with pointer in c?

625


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

754


Where are the auto variables stored?

626


how we can make 3d venturing graphics on outer interface

4012


write a program to rearrange the array such way that all even elements should come first and next come odd

1764






main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

615


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2303


Explain what are the __date__ and __time__ preprocessor commands?

594


Why pointers are used?

633


What are structural members?

574


What is the difference between ++a and a++?

697


console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above

657


What is the difference between typedef struct and struct?

602


How old is c programming language?

581


How will you write a code for accessing the length of an array without assigning it to another variable?

616