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 program that can show the multiplication table.

0 Answers   Student,


What is the description for syntax errors?

0 Answers  


44.what is the difference between strcpy() and memcpy() function? 45.what is output of the following statetment? 46.Printf(“%x”, -1<<4); ? 47.will the program compile? int i; scanf(“%d”,i); printf(“%d”,i); 48.write a string copy function routine? 49.swap two integer variables without using a third temporary variable? 50.how do you redirect stdout value from a program to a file? 51.write a program that finds the factorial of a number using recursion?

3 Answers  


How to calculate Total working time using Login and logout?

2 Answers   CTS, Cygnus, Infosys, Signal Networks, TCS, Wipro,


Explain output of printf("Hello World"-'A'+'B'); ?

0 Answers  






What is C++

4 Answers  


Explain demand paging.

1 Answers   Agilent,


Is r written in c?

0 Answers  


write a program to swap bits in a character and return the value prototype of function char fun (char a, charb flag c) where fun returns a char, char a is a the value char b is the bit to be changed and flag c is the bit value for eg: x=fun(45,7,0) since 45 is 0010 0101 and ow x should contain the value 65 (0110 0101)

1 Answers   Bosch, College School Exams Tests,


What is the purpose of the statement: strcat (S2, S1)?

0 Answers  


What are the 5 elements of structure?

0 Answers  


Is array a primitive data type in c?

0 Answers  


Categories