Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to add two numbers without using arithmetic operators?

Answer Posted / srinu

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,i,j,k=0;
printf("enter 2 numbers");
scanf("%d%d",&a,&b);
if(a>b)
{
k=b;
for(i=1;i<=a;i++)
k++;
}
else
{
k=a;
for(j=1;j<=b;j++)
k++;
}
printf("sum of 2 numbers is %d",k);
}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the advantages of using macro in c language?

1007


Why array is used in c?

1026


When is a void pointer used?

1248


What is modifier & how many types of modifiers available in c?

1032


What is the time and space complexities of merge sort and when is it preferred over quick sort?

1087


What is difference between array and pointer in c?

1101


What are register variables in c?

1020


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

1147


How can I remove the leading spaces from a string?

1178


Is null a keyword in c?

1201


How can I rethow can I return a sequence of random numbers which dont repeat at all?

1194


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2326


Are pointers integers in c?

1084


Why is it that not all header files are declared in every C program?

1231


in iso what are the common technological language?

2120