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

Is it possible to execute code even after the program exits the main() function?

1281


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

1002


What happens if a header file is included twice?

985


What is the meaning of c in c language?

1074


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

2105


What is wrong in this statement?

1080


regarding pointers concept

1980


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

1118


What is main function in c?

1015


Explain the term printf() and scanf() used in c language?

999


Where can I get an ansi-compatible lint?

1100


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

3019


What is the use of structure padding in c?

1014


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

1023


What does 3 mean in texting?

1030