Program to find the absolute value of given integer using
Conditional Operators
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
What is the best way of making my program efficient?
develop algorithms to add polynomials (i) in one variable
Write a program to accept a character & display its corrosponding ASCII value & vice versa?
write a program that eliminates the value of mathematical constant e by using the formula e=1+1/1!+1/2!+1/3!+
Describe the modifier in c?
why we use pointer in c
Why cann't whole array can be passed to function as value.
What are the different types of C instructions?
Explain what is dynamic data structure?
What are static functions?
is assignment operator is arithmatic or not
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } what is the output?