Search:

Type: Posts; User: rusahupe

Search: Search took 0.01 seconds.

  1. We can swap two numbers using Xor operator.

    I was searching for how to swap two numbers without temporary variable. Then I came across this blogpost.

    He used xor operator to swap. I was amazed to see it.
    Here is his program

    ...
  2. Replies
    5
    Views
    1,198

    I think this will work fine.

    Here is the simple approach.


    #include<stdio.h>
    int main()
    {
    int n;
    scanf("%d",&n);
    while(n<0)
    {
Results 1 to 2 of 4