155k views
3 votes
Write a python program to initialize the value of two variables then find sum

User Aneta
by
4.1k points

2 Answers

1 vote

Answer:

#Ask the user for a number

a = int(input("Enter a number: "))

#Ask the user for a number

b = int(input("Enter a number: "))

#Calculate the sum of a and b

sum = a + b

#print the ouput

print(str(a) + " + " + str(b) + " = " + str(sum))

User ChrisGuest
by
4.6k points
4 votes

Answer:

JavaScript:

Let x = 10

Let y = 10

Console.log(x + y)

//outputs 20

C++:

Let x = 10

Let y = 10

The file is Math.cpp so,

std::cout << "" + y + "" + x

g++ Math.cpp -o Maths

./Maths

//Outputs 20

User Kefs
by
4.2k points