Like us on google+

Thursday, 14 November 2013

Widgets

C PROGRAM TO SWAP TWO NUMBERS WITHOUT USING TEMPORARY VARIABLES

#include<stdio.h>

int main(){

    int a=10,b=20;

    //type 1
    a=b+a;
    b=a-b;
    a=a-b;
    printf("a= %d  b=  %d",a,b);

    

    //type 2
    a=a^b;
    b=a^b;
    a=b^a;
    printf("\n a= %d  b=  %d",a,b);



    return 0;
}

SHARE THIS POST   

  • Facebook
  • Twitter
  • Myspace
  • Google Buzz
  • Reddit
  • Stumnleupon
  • Delicious
  • Digg
  • Technorati
About us:
Hi guys Sandesh and Rajesh here ... studing engineering in PESIT started this blog as a google contest and also we love blogging ...Hope u like it ...Encourage us by liking us on g+... Any queries dont hesitate to ask Read More →

0 comments: