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 are the difference between a free-standing and a hosted environment?

0 Answers   Infogain,


WHOT IS CHAR?

4 Answers   TCS,


what is the disadvantage of using macros?

1 Answers   Wipro,


what is the diffrenet bettwen HTTP and internet protocol

0 Answers  


what will be the output of "printf("%d%d",scanf("%d% d",&a,&b))".provide an explation regarding the question

6 Answers  






What is f'n in math?

0 Answers  


input may any number except 1,output will always 1.. conditions only one variable should be declare,don't use operators,expressions,array,structure

4 Answers   IBM,


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

0 Answers  


what is the difference between getch() and getchar()?

10 Answers   Huawei, Infosys,


c program to input values in a table(using 2D array) and print odd numbers from them

1 Answers  


How do I use void main?

0 Answers  


What will be printed as the result of the operation below: #include<..> int x; int modifyvalue() { return(x+=10); } int changevalue(int x) { return(x+=1); } void main() { int x=10; x++; changevalue(x); x++; modifyvalue(); printf("First output:%d\n",x); x++; changevalue(x); printf("Second output:%d\n",x); modifyvalue(); printf("Third output:%d\n",x); }

2 Answers  


Categories