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
Is it possible to execute code even after the program exits the main() function?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
What happens if a header file is included twice?
What is the meaning of c in c language?
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.
What is wrong in this statement?
regarding pointers concept
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
What is main function in c?
Explain the term printf() and scanf() used in c language?
Where can I get an ansi-compatible lint?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
What is the use of structure padding in c?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
What does 3 mean in texting?