CodeSolved

Solved Programming Questions & Exercises

To move the value of 2 variables

Practice Easy 18/ Download 2139 Views

Write a program that receives 2 numeric value from the input and stores in variables A and B. Then move the values ​​of these two variables (the value of variable A is to be stored within B and the value of variable B is saved within a)

13 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
a = int(input('a: '))
b = int(input('b: '))
a,b = b,a
print('...........')
print('a: ',a)
print('b: ',b)
Roham Download Python
a = []
b = []

num1 = int(input("1.Enter a number: "))
num2 = int(input("2.Enter a number: "))

a.append(num1)
b.append(num2)

print("a =",a ,"b =",b)

a , b = b , a
print("a =",a ,"b =",b)

User 3382 Download Python
a = int(input("please enter a number: "))
b = int(input("please enter a number: "))
print("a = ", a ,"/", "b = ", b)
a, b = b, a
print("a = ", a ,"/", "b = ", b)

It was very good and one point I got in the quadruple line that A, B "simultaneously" was used and it wouldn't be the case. User 35


Hi good time. Thank you. I am glad to help you. Alirezamoghaddam


# Get two numeric values ​​from the user
a = int(input("لطفاً مقدار عددی اول را وارد کنید: "))
b = int(input("لطفاً مقدار عددی دوم را وارد کنید: "))
# The displacement of values ​​A and b
a, b = b, a
# Displays
print("پس از جابه‌جایی:")
print("مقدار a:", a)
print("مقدار b:", b)
Milad.bio Download Python
var num1 = prompet("عدد a")
var num2 = prompet("عدد b")
var as = num1
var as2 = num2
num1 = as2
num2 = as
a = int(input("enter a number: "))
b = int(input("enter a number: "))

print("befor:")
print(f"a:{a}")
print(f"b:{b}")
a,b = b,a

print("after:")
print(f"a:{a}")
print(f"b:{b}")
User 195 Download Python
value_1 = int(input("pleas enter the number :"))    # Get the first value
value_2 = int(input("pleas enter the number :"))    # Receive a second value
value_1,value_2 = value_2,value_1                   # Displacement of the first value with the second value
print(f"value 1 : {value_1}")                       # Printing the first variable value after change
print(f"value_2 : {value_2}")                       # Printing the second variable value after change
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close