May 28 2011 05:47 PM 6480 12 swapping of two numbers rabia.sultana14 How to swap two numbers without using temporary variable? mahamadalig Profile Answers by mahamadalig Questions by mahamadalig May 7th, 2012 Code#include<stdio.h> #include<conio.h> void main() { int i=54,j=43; printf("BEFORE SWAPPPED "); printf("%d,%d ",i,j); i=i+j; j=i-j; i=i-j; printf("BEFORE SWAPPPED "); printf("%d,%d ",i,j); } Tanuja Jaiswal Jan 26th, 2012 #include void main() { int a,b,temp; printf("Enter values for a and b "); scanf("%d %d",&a , &b); printf("values before swaping are : %d %d",a,b); temp=a; a=b; b=temp; printf("After swaping values are : a= %d b=%d,a,b); getch(); } Answer Question Select Best Answer
May 28 2011 05:47 PM 6480 12 swapping of two numbers rabia.sultana14 How to swap two numbers without using temporary variable? mahamadalig Profile Answers by mahamadalig Questions by mahamadalig May 7th, 2012 Code#include<stdio.h> #include<conio.h> void main() { int i=54,j=43; printf("BEFORE SWAPPPED "); printf("%d,%d ",i,j); i=i+j; j=i-j; i=i-j; printf("BEFORE SWAPPPED "); printf("%d,%d ",i,j); } Tanuja Jaiswal Jan 26th, 2012 #include void main() { int a,b,temp; printf("Enter values for a and b "); scanf("%d %d",&a , &b); printf("values before swaping are : %d %d",a,b); temp=a; a=b; b=temp; printf("After swaping values are : a= %d b=%d,a,b); getch(); } Answer Question Select Best Answer
mahamadalig Profile Answers by mahamadalig Questions by mahamadalig May 7th, 2012 Code#include<stdio.h> #include<conio.h> void main() { int i=54,j=43; printf("BEFORE SWAPPPED "); printf("%d,%d ",i,j); i=i+j; j=i-j; i=i-j; printf("BEFORE SWAPPPED "); printf("%d,%d ",i,j); }
Tanuja Jaiswal Jan 26th, 2012 #include void main() { int a,b,temp; printf("Enter values for a and b "); scanf("%d %d",&a , &b); printf("values before swaping are : %d %d",a,b); temp=a; a=b; b=temp; printf("After swaping values are : a= %d b=%d,a,b); getch(); }