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 is 1f in c?

0 Answers  


What are header files and what are its uses in C programming?

0 Answers  


What is int main () in c?

0 Answers  


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

2 Answers   ME,


Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

0 Answers  


Why is sizeof () an operator and not a function?

0 Answers  


int j =15,i; for (i=1; 1<5; ++i) {printf ("%d%d ",j,i); j = j-3; }

2 Answers  


How many types of operator or there in c?

0 Answers  


Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning

4 Answers   Accenture,


the output will be #include<stdio.h> int main () { int i; i = 9/2; printf("%i",i); return 0; }

4 Answers   CMC, TCS,


Do you know the difference between malloc() and calloc() function?

0 Answers  


1,1,5,17,61,217,?,?.

3 Answers   Apple,


Categories