answersLogoWhite

0

first you make 3 integer variables. lets called them sum1, num1 and num2

then you get user imput that will assign num1 and num2 with values or make a statment giving them valvues such as

num1=5

num2=3

then you make a statement that assigns sum1 a valvue,

sum1=num1 + num2

Thats it.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

2 Write a program to print a following program?

USING STRING LITERAL VALUES TO ADD 2 NUMBERS If you just want to show the outcome of two numbers you have: PRINT 4 + 5 This will print '9' the answer to 4 + 5. If you want to show the addition: PRINT "4 + 5 = "; 4 + 5 This will show the question and then calculate the answer. If you want the user to input numbers to add, use variables and then add them the same way. ====== COLLECTING USER INPUT FROM THE KEYBOARD/USING NUMERIC VARIABLES In the following example, the end user can get to interact with the program by typing in their numbers at the keyboard; then, pressing the [Enter] key. CLS PRINT "PROGRAM: Add 2 numbers" PRINT INPUT "Enter the 1st number: ", number1 INPUT "Enter the 2nd number: ", number2 PRINT sumTotal=number1+number2 PRINT "The sum total is: "; sumTotal PRINT INPUT "Again, Y/N"; yesNo$ IF UCASE$(LEFT$(yesNo$,1))="Y" THEN RUN END ====== CREATE FUNCTION/THEN, MAKE A FUNCTION CALL TO ADD 2 NUMBERS Another way to write this program is to create a function/then, make a function call... '*** PROGRAM: Add 2 numbers... '*** Variable declaration list... number1=7 '...initialise numeric variable 1 number2=3 '...initialise numeric variable 2 '*** Main program... CLS '...(CL)ear the (S)creen PRINT add(number1,number2) '...make function call/passing in 2 numbers to add END '...END of program/halt program code execution '*** Function(s)... FUNCTION add(num1,num2) '...this line marks the start of the Function add=num1+num2 '...this line returns the sum total of the 2 numbers END FUNCTION '...this line marks the end of the Function


Write a program in 8051 to add 2 16- bit numbers?

Mov a.#000ff, mov b,#0008f add a,b


How do you add 2 numbers in QBASIC?

I'm not too sure that I understand exactly what you mean by 'add a square'...?! Thus, I will attempt to answer the question using multiple different ways; hoping that, least, 'one' of these answers might be right... ==> CLS PRINT "PROGRAM: Twelve Times Tables Number Square" PRINT FOR intTimes% = 1 TO 12 FOR intTables% = 1 TO 12 sum% = intTimes% * intTables% noOfSpaces% = 0 IF LEN(STR$(sum%)) = 2 THEN noOfSpaces% = 2 IF LEN(STR$(sum%)) = 3 THEN noOfSpaces% = 1 PRINT sum%; SPC(noOfSpaces%); NEXT PRINT NEXT END <== ...QBASIC Code/End.


How do you find the median for groups if numbers?

you add the numbers together than divide that by 2, after that you add how many numbers there are then subtract 2


How do you create a mirror image of letters and numbers on a Windows program?

1 2 3 4 5 6 7 8 9


What if there are 2 numbers in the median?

If there are 2 numbers as the median, you find the mean of those 2 numbers. (add both numbers and divide by 2)


What are the numbers when you add you get -3 when multiplied you get 40?

There are no two real numbers that do. Using complex numbers, these two do: (-3/2 + i√151/2) & (-3/2 - i√151/2) Two numbers that add to -3 and multiply to -40 are -8 & 5 Two numbers that add to 3 and multiply to -40 are 8 & -5 Two complex numbers that add to 3 and multiply to 40 are (3/2 + i√151/2) & (3/2 - i√151/2)


Create a c plus plus program that displays odd numbers between 15 and 30?

for (int i = 15; i < 30; i += 2) cout << i << endl;


What do you get when you add numbers?

if you add 1+1 it = 2 get it :D


Do you have to be able to program to create a website?

no i have 2 of them


What two numbers multiply to get 35 and add to 2?

The two numbers that multiply to get 35 and add to 2 are 7 and -5. When you multiply them (7 * -5), you get -35, and when you add them (7 + -5), you get 2. Thus, the numbers are 7 and -5.


What 2 numbers make -15 which add together as 2?

The two numbers that multiply to -15 and add up to 2 are 5 and -3. When you multiply 5 and -3, you get -15, and when you add them together, you get 2.