Skip to content

Instantly share code, notes, and snippets.

@sachinsaxena25
Last active August 1, 2019 14:46
Show Gist options
  • Save sachinsaxena25/198e4e063ba56df838a8af1dba7d85b6 to your computer and use it in GitHub Desktop.
Save sachinsaxena25/198e4e063ba56df838a8af1dba7d85b6 to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main(void){
int x1 = 0;
int x2 = 0;
printf("please enter the first number:\n");
scanf("%d", &x1);
printf("please enter the second number:\n");
scanf("%d", &x2);
printf("The numbers before swapping are x1 = %d x2 = %d", x1, x2);
x1 = x1 + x2;
x2 = x1 - x2;
x1 = x1 - x2;
printf("Swaped Number are:%d %d", x1, x2);
return 0;
}
@dbc2201
Copy link

dbc2201 commented Jul 29, 2019

Edit the printed statement to enter only one variable at a time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment