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
Give differences between - new and malloc() , delete and free() ?
What is a example of a variable?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
What is static identifier?
What are the scope of static variables?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
What is the difference between text files and binary files?
Why can't I perform arithmetic on a void* pointer?
writ a program to compare using strcmp VIVA and viva with its output.
What are the advantages of c language?
Tell us the use of fflush() function in c language?
Are there namespaces in c?
How can I read a binary data file properly?
What is static memory allocation? Explain
Explain the difference between ++u and u++?