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  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
how to add numbers without using arithmetic operators.
 Question Submitted By :: Sunny
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 1
use ++ operator
 
Is This Answer Correct ?    3 Yes 5 No
Bijoy Skaria
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 2
suppose a=6 and b=3

we can write c=a-(-b)
which will give us c=9
 
Is This Answer Correct ?    2 Yes 11 No
Satish Gaikwad
 
 
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 3
oh sorry I have considered as addition operator
 
Is This Answer Correct ?    2 Yes 3 No
Satish Gaikwad
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 4
use the variable u can get it
 
Is This Answer Correct ?    2 Yes 3 No
Mokka Samy
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 5
#include<Stdio.h>
#include<conio.h>

void main()
 {
   int a=10,b=20;
   while(b--) a++;
      printf("Sum is :%d",a);  
 }
 
Is This Answer Correct ?    4 Yes 7 No
Santhi Perumal
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 6
#include <stdio.h>

int main ( int argc, char* argv [ ] )
{
	int value1 = 10;
	int value2 = 5;
	printf ( "\n The sum is :%d", value1 | value2 );
}
 
Is This Answer Correct ?    4 Yes 8 No
Abdur Rab
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 7
#include <stdio.h>

int add(int a,int b)
{
  if(!a)
     return b;
  else
     return add((a&b)<<1,a^b);
}

void main()
{
        int a=2, b=3, c;
        c = add(a,b);
        printf("%d\n",c);
}
 
Is This Answer Correct ?    6 Yes 3 No
Sneha
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 8
#include<stdio.h>
int main()
{
 int a=3,b=5;
 while(a--)
 b = b++;
 
 printf("%d\n");

}
 
Is This Answer Correct ?    1 Yes 2 No
Dally
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 9
#include<stdio.h>

int main()
{
   int x=5,y=10;   //Use scanf otherwise
   int z=add(x,y);
   return 0;
}

int add(int a,int b)
{  
   int i;
   for(i=0;i<b;i++)
   {
     a++;
   }
   return a;
}
 
Is This Answer Correct ?    0 Yes 1 No
Mobashyr
 
  Re: how to add numbers without using arithmetic operators.
Answer
# 10
#include<stdio.h>
main()
{
 int a=5,b=6,s;
 int *p=a;
 s=&p[b];
 printf("%d",s);
}
 
Is This Answer Correct ?    1 Yes 1 No
Valli
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Reverse the part of the number which is present from position i to j. Print the new number.[without using the array] eg: num=789876 i=2 j=5 778986  2
9.how do you write a function that takes a variable number of arguments? What is the prototype of printf () function? 10.How do you access command-line arguments? 11.what does ‘#include<stdio.h>’ mean? 12.what is the difference between #include<> and #include”…”? 13.what are # pragma staments? 14.what is the most appropriate way to write a multi-statement macro? L&T4
what is memory leak?  3
Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….  1
what is the output? #define fun(a,b,t) (g ##t=(a),(a)=(b),(b)=g##t) float gfloat; main() { float a=1.12,b=3.14; fun (a,b,float); printf("na=%4.2f,b=%4.2f",a,b); } A)Error in Defining Macro B)a=1.12,b=3.14 C)a=3.14,b=1.12 D)None of the Above Accenture2
Two's compliment of -5 Adobe3
What will be the output of x++ + ++x? MBT13
What is the difference between typeof(foo) and myFoo.GetType()?  1
Is main() function predfined or userdefined?  7
what is the difference between these initializations? Char a[]=”string”; Char *p=”literal”; Does *p++ increment p, or what it points to?  2
which header file contains main() function in c? TCS3
what is difference between overriding and overloading?  1
write a fuction for accepting and replacing lowercase letter to'Z' with out using inline function. Temenos4
print the following using nested for loop. 5 4 3 2 1 1 2 3 4 3 2 1 1 2 1 2 1 1 2 3 4 3 2 1 1 2 3 4 5  5
what is difference between array and structure? TCS19
what is the diff between the printf and sprintf functions?? and what is the syntax for this two functions ??  4
for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????  6
what does " calloc" do? Cadence6
Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack  3
how to estimate the disk access time? e.g. the time between read one byte and another byte in the disk. Google3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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