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

WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE . Example: Enter the numbers :3 * * * * * * * *

3 Answers   Infosys, TCS,


What is double pointer?

0 Answers  


which do you prefer C or Pascal?

1 Answers  


What is 1d array in c?

0 Answers  


being a chemical engineer and with an aggregate of 80% why you opt for TCS and not your core industry?

1 Answers   TCS,






What is #pragma statements?

0 Answers  


write a own function for strstr

1 Answers   LG Soft,


What will be the output of the following program #include<stdio.h> void main() { int i=20; i-=i+++++i++; printf("%d",i); }

5 Answers  


What is volatile, register definition in C

0 Answers   Cognizant,


1. Write a C program to count the number of occurrence of a specific word in the given strings. (for e.g. Find how many times the word “live” comes in the sentence “Dream as if you’ll live forever, live as if you’ll die today ”)

12 Answers   Eskom, TCS,


What is a char c?

0 Answers  


how to devloped c lenguege?

4 Answers  


Categories