logo codesdope

How do I swap two numbers and two digits.

   heavycodes , DPS

How can I make one python program in which I will enter two numbers one by one they will tell me the entered number and the swapped number.

Example – if entered 23, then it will show The entered number is 23, The swapped number is 32, then if i enter 32 it will show me 23.

I have two numbers to input.

The count of variables should not be 3 or exceeding 3.

  • Please Tell.
    - heavycodes
  • x=int(input("Enter the number)) first_digit=x//10 second_digit=x%10 swapped_number=(second_digit*10)+first_digit print(swapped_number)
    - tanyatyagi01
  • in this way you will get your answers. try the numbers in the code
    - tanyatyagi01

Answers

  •    tanyatyagi01

    x=int(input("Enter the number))

    first_digit=x//10

    second_digit=x%10

    swapped_number=(second_digit*10)+first_digit

    print(swapped_number)



Write your answer
Close

Welcome.please sign up.

Close

Welcome.please login.