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

What does void main return?

1117


What are the types of pointers in c?

1022


what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

2377


why do some people write if(0 == x) instead of if(x == 0)?

1068


Stimulate calculator using Switch-case-default statement for two numbers

2984


Explain the difference between null pointer and void pointer.

1078


Explain the process of converting a Tree into a Binary Tree.

2661


Disadvantages of C language.

1099


What is sizeof c?

1070


What are the similarities between c and c++?

1065


What does c mean in basketball?

994


Why is extern used in c?

1091


What is the difference between array and pointer in c?

1157


Write a factorial program using C.

1072


What are valid operations on pointers?

1195