void main()
{
int a=10,b=20;
while(b--) a++;
printf("Sum is :%d",a);
}

9 Users have rated as useful.
Login to rate this answer.
int i,j;
if(i<j)
{
for(i=0;i<=j;i++)
j++;
cout<<j;
}
else
{
for(j=0;j<=i;j++)
i++;
cout<<i;
}

1 User has rated as useful.
Login to rate this answer.
#include
int main()
{
unsigned int t = 0xffffffff;
unsigned int z = 1;
int a = 10, b = 10, sum = 0, r = 0;
while (t) {
int t1, t2;
t1 = a & 0x00000001;
t2 = b & 0x00000001;
if ((t1 ^ t2 ^ r) == 1) {
if (t1 == 1 && t2 == 1 && r == 1)
r = 1;
else
r = 0;
sum = sum | z;
} else {
if (t1 == 0 && t2 == 0 && r == 0)
r = 0;
else
r = 1;
}
a >>= 1;
b >>= 1;
z <<= 1;
t >>= 1;
}
printf("sum: %dn", sum);
return 0;
}
Login to rate this answer.
| Arithmetic operators |
| Operator Name | Syntax | Overloadable | Included in C |
| Unary Plus | +a | Yes | Yes |
| Addition (Sum) | a + b | Yes | Yes |
| Prefix Increment | ++a | Yes | Yes |
| Postfix Increment | a++ | Yes | Yes |
| Assignment by Addition | a += b | Yes | Yes |
| Unary Minus (Negation) | -a | Yes | Yes |
| Subtraction (Difference) | a - b | Yes | Yes |
| Prefix Decrement | --a | Yes | Yes |
| Postfix Decrement | a-- | Yes | Yes |
| Assignment by Subtraction | a -= b | Yes | Yes |
| Multiplication (Product) | a * b | Yes | Yes |
| Assignment by Multiplication | a *= b | Yes | Yes |
| Division (Quotient) | a / b | Yes | Yes |
| Assignment by Division | a /= b | Yes | Yes |
| Modulus (Remainder) | a % b | Yes | Yes |
| Assignment by Modulus | a %= b | Yes | Yes |

1 User has rated as useful.
Login to rate this answer.
Use minus operator :-
int a=10,b=20,c;
c=a-(-b);

3 Users have rated as useful.
Login to rate this answer.
void main()
{
int a=10,b=10;
a=a<<1;
b=b<<1;
printf("Sum of a&b is %dn",(a&b));
}
Login to rate this answer.
#include add(int a,int b)
{
if(!a) return b;
else return add((a&b)<<1,a^b);
}
void main()
{ int a=2, b=5,c; c= add(a,b);
cout<<c;
}
hope it 'll help you right...........

1 User has rated as useful.
Login to rate this answer.
void main(){
int a=5,b=7,i;
for(i=1;i<=a;i++)
b++;
printf("sum value:%d",b);
}
Login to rate this answer.
Code
for (i = 0; i < a; i++)
{
count++;
}
for (j = 0; j < b; j++)
{
count++;
}
Login to rate this answer.
Code
#include<stdio.h>
int main()
{
int i = 1, j = 20, c;
c = (i ^ j);
return 0;
}
Login to rate this answer.
Code
main()<br />{<br />cout<<"Enter the numbers to be added";<br /> int a,b,x,y;<br /> cin>>a>>b;<br /> <br />do{<br /> x=a&b;<br /> y=a^b;<br /> x=a<<1;<br /> y=b;<br />}while(a);<br />cotu<<"The sum is:"<<y;<br />}
Login to rate this answer.
Code
#include<stdio.h>
main()
{
int a, b, c, d, sum;
printf("n Please enter a,b values:");
scanf("%d %d", &a, &b);
if (b > a) {
c = b - a;
} else {
c = a - b; // using minus operator
}
d = square(b) - square(a); // using square function and - minus operator
sum = d / c; // using division operator
printf("The sum of a and b is:%d", sum
);
return 0;
}
Login to rate this answer.
Code
#include<stdio.h>
int result = 0X0;
int a, b, C = 0X0, aB, bB;
int main()
{
int val = 0X1;
scanf("%d%d", &a, &b);
while (val) {
aB = !!(a & val);
bB = !!(b & val);
if (aB ^ bB ^ C)
result |= val;
C = (aB & bB) | ((aB ^ bB) & C);
val <<= 1;
}
return 0;
}
Login to rate this answer.
Code
class Test {
public static void main(String ... z) {
System.out.println(4 || 8); //use logical or symbol u can add it
}}
Login to rate this answer.
sravan
Answered On : Aug 20th, 2011
Code
#include<iostream.h>
void main()
{
int i=20,j=30,m,n;
m=i,n=j;
if(i<j)
{
for(i=1;i<=m;i++)
j++;
cout<<j;
}
else
{
for(j=1;j<=n;j++)
i++;
cout<<i;
}
}
Login to rate this answer.
mukesh kumar
Answered On : Mar 25th, 2012
Code
int main(){
int a,b;
printf("Enter the two numbers:
");
scanf("%d",&a);
scanf("%d",&b);
printf("Sum is: %d",add
(a
,b
));
}
Login to rate this answer.
mahamad
Answered On : Jun 14th, 2012
Code
#include<stdio.h>
#include<conio.h>
main()
{
int a=20,b=10,c;
clrscr();
c=a-~b-1; //it will change the sign of operator truly magic
getch();
return 0;
}
Login to rate this answer.
And
Answered On : Aug 28th, 2012
For two positive numbers:
int main(){
int a = 10;
int b = 10;
printf("%d",a ^ b | ((a & b)<< 1));
return 0;
}
Login to rate this answer.