#include<stdio.h>
#include<conio.h>
void main()
{
int x,y;
clrscr();
printf("\n enter the elements\n");
scanf("%d%d",&x,&y);
printf("\n before swaping x=%d,y=%d",x,y);
x=x^y;
y=y^x;
x=x^y;
printf("\n after swaping x=%d y=%d",x,y);
getch();
}
Compare the first two numbers with the ternary operator. Store the result in a temporary variable. Compare the temporary variable with the third number, again using the ternary operator.
By using the algorithm of bitwise EORing (Exclusive ORing) the numbers together:If the two numbers are X and Y, then to swap them:X = X EOR YY = Y EOR XX =X EOR Ywill swap them.With knowledge of that algorithm, one then uses the syntax of Javascript to implement it.
The bitwise complement or one's complement operator (~) is used to switch the state of all the bits in a value. Thus 1's become 0, and 0's become 1. One of its many uses is to unset individual bit(s) in a bitmap. We do this with a bitwise AND of the bitmap and the bitwise complement of the bit(s) we want to unset. Original bitmap: 01011100 Bit to unset: 00000100 (e.g., bit 2 (bits are zero based from right)) // Using one's complement and bitwise AND ~00000100 & 01011100 11111011 (one's complement of bit 2) & 01011100 (original bitmap) = 01011000 (original bitmap with bit 2 unset) Note that this formula works even if bit 2 were already unset: 11111011 (one's complement of bit 2) & 01011000 (original bitmap, with bit 2 unset) = 01011000 (original bitmap unchanged)
You cannot compare 2 numbers without using relational operators. Certainly, you could subtract them, but you still need to test the result, and that is a relational operator in itself.
AnswerThe bitwise operators treat a number as its binary equivalent rather than as a simple boolean value.For most programming languages, a value of zero is considered FALSE and all other values are TRUEThus, 8 AND 11 returns TRUE as does 3 OR 0In bitwise analysis, each binary bit of the digit are compared. The number of bits compared will depend on the type of number.In C, a CHAR is usually 8 bits and can hold the binary numbers 0 to 255.If we compare 8 (00001000) and 19 (00010011) with bitwise operators, we get different results from Boolean operators:8 BITWISE AND 19 returns 0 (each bit in the response is set to 1 if both equivalent bits compared are 1) but 8 BITWISE OR 19 will return 27.The utility of these methods is in identifying binary data. For example, all files on a PC have the characteristics 'Hidden' 'Read Only' 'Archive' and 'System' which can be set or unset using bitwise operations on a single byte of data. In truth this is a throwback to the days of small memory capacities where saving the odd byte was essential.There are more uses of bitwise, especially in graphics, where XOR can be used to paint a sprite image to display it and then be used again to return a background to its former settings. I regret I lack the skill to explain this better.
//lets assume a = 10; b = 20; a = a^b; b = a^b; a = a^b;
num1 <<= 1; /* shift left */
It is Subtraction, using the minus sign. For example: =A5-C10
first add the whole numbers then do simple fraction subtraction
Compare the first two numbers with the ternary operator. Store the result in a temporary variable. Compare the temporary variable with the third number, again using the ternary operator.
Addition and subtraction.
Professor Layton? 41268 - 7935 (or 41286 - 7153)
Yes it matters. Subtraction is not commutative. Example: 5-2 = 3 (positive three), but 2-5 = -3 (negative three)
Not possible. Of course you can call a function which does the addition for you, but function-calling is also an operator in C.
The greatest difference is 541
There are 175 solutions all together.
It is: 23+(4*7) = 36.