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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / apoorv gaurav

#include<stdio.h>
int main()
{
int a;
printf("Enter any number");
scanf("%d",&a);
if(a>=0)
printf("%d",a);
printf("%d",(-1*a));
return 0;
}

Is This Answer Correct ?    7 Yes 5 No

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

Answer / 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

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

Answer / 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

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

Answer / bushahiro emmy

#include<stdio.h>
#include<math.h>
int main()
{
int X;
printf("Entrez un nombre: ");
scanf("%d",&X);
printf("la valeur absolue de %d est %.2lf.\n",X,fabs
(X));
return 0;
}

Is This Answer Correct ?    7 Yes 9 No

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

Answer / susanta datta

16

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C Interview Questions

What is the best way of making my program efficient?

0 Answers  


develop algorithms to add polynomials (i) in one variable

0 Answers   Ignou, TCS,


Write a program to accept a character & display its corrosponding ASCII value & vice versa?

9 Answers  


write a program that eliminates the value of mathematical constant e by using the formula e=1+1/1!+1/2!+1/3!+

1 Answers   Reliance,


Describe the modifier in c?

0 Answers  


why we use pointer in c

7 Answers   HCL, TCS,


Why cann't whole array can be passed to function as value.

1 Answers  


What are the different types of C instructions?

0 Answers   InterGraph,


Explain what is dynamic data structure?

0 Answers  


What are static functions?

1 Answers  


is assignment operator is arithmatic or not

3 Answers   Infosys,


main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } what is the output?

10 Answers   Ramco,


Categories