Home
About
Contact
Header Ads Widget
Home
Coding Questions
_C/C++ Programs
_Python Programs
_Data Structure Programs
_Competitive Coding
Practice Problems
Key Points
Notes
MCQs
Interview
Trends
Home
python_programs
Write a python program to swap two numbers without using third variable.
Write a python program to swap two numbers without using third variable.
Rajnish Tripathi
01:28
Program:-
a=
int
(
input
(
"a="
))
b=
int
(
input
(
"b="
))
print
(
"Values before swapping\n"
,
"a="
,
a
,
"b="
,
b
)
a=a+b
b=a-b
a=a-b
print
(
"Values after swapping\n"
,
"a="
,
a
,
"b="
,
b
)
Output:-
a=
2
b=
3
Values before swapping
a=
2
b=
3
Values after swapping
a=
3
b=
2
Post a Comment
0 Comments
Popular post
PPS 1st year (C programming ) handwritten notes Aktu
11:47
pps unit 1 notes
09:54
Python : missing characters : hackerrank solution
23:01
Social Plugin
MCQs
3/MCQs/post-list
Tags
c-programs
Companies
competitve programs
Data structure
doubts
key points
MCQs
Notes
practice problems
python
0 Comments