ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Program to find the absolute value of given integer using
Conditional Operators
 Question Submitted By :: Vaasu
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Program to find the absolute value of given integer using Conditional Operators
Answer
# 1
#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 ?    0 Yes 0 No
Vignesh1988i
 
  Re: Program to find the absolute value of given integer using Conditional Operators
Answer
# 2
#include <stdio.h>

int main ( int argc, char* argv  [] )
{
	int value = -10;
	printf ("\n%d", ( value >= 0 ) ? value : ~(value)
+1 );
}
 
Is This Answer Correct ?    0 Yes 0 No
Abdur Rab
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
write a program to check whether a given integer is a strong number or not? [Hint: 145=1!+4!+5! =1+24+120 =145]  1
What is a class?  1
What is the memory allocated by the following definition ? int (*x)(); ADITI2
what is the diff between the printf and sprintf functions?? and what is the syntax for this two functions ??  4
int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p? Verifone4
what is a function pointer and how all to declare ,define and implement it ??? Honeywell3
what does data structure mean?  7
Difference between Class and Struct. Motorola4
WHAT IS MAXIMUM SIZE OF AN ARRAY IN C LANGUAGE? IBM4
what is the stackpointer  2
You are given a string which contains some special characters. You also have set of special characters. You are given other string (call it as pattern string). Your job is to write a program to replace each special characters in given string by pattern string. You are not allowed to create new resulting string. You need to allocate some new memory to given existing string but constraint is you can only allocate memory one time. Allocate memory exactly what you need not more not less. Microsoft1
write a program to find out number of on bits in a number? Huawei11
can we access one file to one directory?  1
prototype of sine function. Cadence2
palindrome for strings and numbers----Can anybody do the prog? TCS5
main() { int a=0; if(a=0) printf("Ramco Systems\n"); printf("India\n"); } output? Ramco6
What's wrong with "char *p = malloc(10);" ?  4
what is the diff b/w static and non static variables in C. Give some examples plz. Wipro2
write a program to check whether a given integer is a strong number or not? [Hint: 145=1!+4!+5! =1+24+120 =145]  2
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
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com