How to add two numbers without using arithmetic operators?

Answers were Sorted based on User's Feedback



How to add two numbers without using arithmetic operators?..

Answer / ramanareddy

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("enter the two numbers");
scanf("%d %d",%a,&b);
c=(-(-a-b));
printf("sum is = %d",c");
getch();
}

Is This Answer Correct ?    0 Yes 4 No

How to add two numbers without using arithmetic operators?..

Answer / abhishek shukla

what will be output of this programme?
#include<stdio.h>
#include<conio.h>
void main()
{
int a=5;
clrscr();
a=a+(2,3,3,5,8,6);
printf("%d",a);
getch();
}

Is This Answer Correct ?    1 Yes 6 No

How to add two numbers without using arithmetic operators?..

Answer / nitish

why cant we just or the two numbers

Is This Answer Correct ?    9 Yes 20 No

How to add two numbers without using arithmetic operators?..

Answer / pugalarasu

int sum(int num1,int num2)
{
for(int i=0;i<num2;i++)
num1++;
return num1;
}

Is This Answer Correct ?    39 Yes 50 No

How to add two numbers without using arithmetic operators?..

Answer / ranjith

#include<stdio.h>
main()
{
int a=5,b=4,c;
c=a||b;
printf("sum="+c);
}

Is This Answer Correct ?    2 Yes 21 No

How to add two numbers without using arithmetic operators?..

Answer / suhas

# include <stdio.h>
main()
{
int a=8,b=2;
a|=b;
printf("sum="+a);
}

Is This Answer Correct ?    7 Yes 43 No

How to add two numbers without using arithmetic operators?..

Answer / kavi

#include<stdio.h>
int a,b,c;
{
printf("enter the two values");
scanf("%d","%d",&a,&b);
c=a||b;
}

Is This Answer Correct ?    10 Yes 80 No

How to add two numbers without using arithmetic operators?..

Answer / prashant

even this gives the same ans as the above program gives...
just every one plz check it and tell me
#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c;
printf("enter the nos");
scanf("%d %d",&b,&c);
a= (b^c);
printf("%d",a);
return 0;
}

Is This Answer Correct ?    19 Yes 114 No

Post New Answer

More C Interview Questions

What should malloc() do?

0 Answers  


what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }

3 Answers  


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

0 Answers  


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?

1 Answers  


void main() { int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} }; int (*p)[2]; int i,j,*pint; for(i=0;i<=3;i++) { p=&s[i]; pint=p; printf("\n"); for(j=0;j<=1;j++) printf("%d",*(pint+j)); } } while running this program it shows a warning-suspicious pointer conversion ie pint=p; my que is why should we assign the value of p to pint again.why cant we use it directly as *(p+j)..but if i use like tat the o/p is garbage value..

1 Answers  






write a program to print calender using for loop.

1 Answers   HCL, TCS,


Is void a keyword in c?

0 Answers  


What is the size of empty structure in c?

0 Answers  


which is conditional construct a) if statement b) switch statement c) while/for d) goto

0 Answers  


How does struct work in c?

0 Answers  


write a c program to find the square of a 5 digit number and print the result.

5 Answers   Accenture, Sasken, Vimukti Technologies,


How do you generate random numbers in C?

0 Answers  


Categories