Computer Science, asked by QueenSaanvi, 6 hours ago

WAP that accepts two numbers from the user and print sum.

Answers

Answered by Kalihacker
1

Answer:

no1=int(input("Enter the first number: "))

no2=int(input("Enter the second number: "))

print("The sum is ",no1+no2)

Answered by Anonymous
11

Numbers sum - Qbasic

Since we are not given/mentioned in the Question that by what programming language we write the required program, so here we are using Qbasic program to accept two numbers from the user and to print sum.

What we need to do

We would take a user input command first, to accept the first number from the user. We can accept the the first number from the user by simply typing INPUT. The INPUT command used to take input from the user.

After that same as first number we also take a user input command, to accept the second number from the user. After this we will add that both two numbers.

We then print out the sum of two numbers with the answer.

\rule{300}{1}

The Program

CLS

INPUT "Enter the first Number"; NUMBER1

INPUT "Enter the second Number"; NUMBER2

SUM = NUMBER1 + NUMBER2

PRINT "The sum of two numbers is"; SUM

END

\rule{300}{1}

Sample output

Enter the first Number? _

Enter the second Number? _

The sum of two numbers is _

Suppose that if you have entered the value of first number as 5 and second number as 10, then the output of the given program will be as follows:

Enter the first Number? 5

Enter the second Number? 10

The sum of two numbers is 15

Similar questions