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 |
WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE . Example: Enter the numbers :3 * * * * * * * *
What is double pointer?
which do you prefer C or Pascal?
What is 1d array in c?
being a chemical engineer and with an aggregate of 80% why you opt for TCS and not your core industry?
What is #pragma statements?
write a own function for strstr
What will be the output of the following program #include<stdio.h> void main() { int i=20; i-=i+++++i++; printf("%d",i); }
What is volatile, register definition in C
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 ”)
What is a char c?
how to devloped c lenguege?