Skip to content

Commit

Permalink
Merge pull request tarunsinghofficial#685 from adityag200/main
Browse files Browse the repository at this point in the history
Create aditya.md
  • Loading branch information
tarunsinghofficial committed Oct 22, 2020
2 parents 95e1756 + a4375c7 commit d689217
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
24 changes: 16 additions & 8 deletions Python-programming-1/swap two numbers
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
num1 = input('Enter First Number: ')
num2 = input('Enter Second Number: ')
num1 = int(input('Enter First Number: '))
num2 = int(input('Enter Second Number: '))

print("Value of num1 before swapping: ", num1)
print("Value of num2 before swapping: ", num2)

# swapping two numbers using temporary variable
temp = num1
num1 = num2
num2 = temp
print("for swapping with using a temp variable enter number greater than 1 otherwise swapped without third variable")
choice = int(input("enter the choice: "))
if choice > 1:
#swapping two numbers using temporary variable
temp = num1
num1 = num2
num2 = temp
print("Value of num1 after swapping using the third variable: ", num1)
print("Value of num2 after swapping using the third variable: ", num2)

print("Value of num1 after swapping: ", num1)
print("Value of num2 after swapping: ", num2)
else:
# swapping two number not using the third variable
num1,num2 = num2,num1
print("Value of num1 after swapping not using the third variable: ", num1)
print("Value of num2 after swapping not using the third variable: ", num2)
5 changes: 5 additions & 0 deletions aditya.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Aditya Gaur

Photo: https://images.unsplash.com/photo-1563170261-90260910461d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80
Location: India
Github: https://github.com/adityag200

0 comments on commit d689217

Please sign in to comment.