menu search
brightness_auto
more_vert
2 1

 Write a program to swap two numbers without using a third variable.

Topic Python Programming
Type Python Program
Class 11
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
0

x = 10

y = 11

print(f'Before swapping x is {x} and y is {y}.')

x = x + y # 21

y = x - y # 10

x = x - y # 11

print(f'After swapping x is {x} and y is {y}.')


Study more about Python at Python Class 10

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike

Related questions

thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
0 answers
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
1 answer
Welcome to Aiforkids, where you can ask questions and receive answers from other members of the community.

AI 2024 Class 10 Board Exams mein 100% laane ka plan OPEN NOW

Class 10 Complete One Shot AI Lectures at - Youtube

1.5k questions

1.4k answers

4 comments

12.3k users

...