Program to evaluate equation, Assembly Language

Write a program to evaluate the following expression.

You are to evaluate the following equation:

num1 - (input + num2) - (num3 + num4)

Input will be a hex number input by the user using Readhex. The input can be 1,2,3,4 or 5 hex digits. num1, num2, num3 and num4 are variables defined in the data section of your program.

When you evaluate the above expression you should follow the normal order of operations for evaluating a math expression. You should evaluate the expressions within the parenthesis first and then work left to right.

For example when you evaluate 7 - 3 - 2 you should work left to right so the answer is: 7 - 3 = 4 - 2 = 2. If you work from right to left you get the wrong answer: 3 - 2 = 1 and 7 - 1 = 6.

You must evaluate the above equation as it is and not simplify it. In other words you must evaluate: num1 - (input + num2) - (num3 + num4) not evaluate something like num1 - input - num2 - num3 - num4 etc.

Also do not reverse the order of the operations within the (). You must evaluate (input+num2) and (num3+num4) and not (num2+input) or (num4+num3). Later we will learn that the order of the operands is important as we write a program to evaluate any expression.

 

Posted Date: 3/18/2013 5:49:24 AM | Location : United States







Related Discussions:- Program to evaluate equation, Assignment Help, Ask Question on Program to evaluate equation, Get Answer, Expert's Help, Program to evaluate equation Discussions

Write discussion on Program to evaluate equation
Your posts are moderated
Related Questions
1. Write a program that will generate an array of ten random 32-bit integers, and that will  display on the monitor the numbers followed by either the words " has the fourth bit se

I want to do a program as a game by using the Microcontroller 8051 with the assembly language, by using 4*4 keypad and its matrix display. I have to use the keypad for playing the

need some project ideas

Conditional branch Instruction When these type of instructions are executed, they transfer control of execution to the address mention relatively in the instruction, provided t

Program : Write an assembly program to find out the number of positive numbers and negative numbers from a given series of signed numbers. Solution : Take the i th num

Queue Operation :   RQ/CT0, RQ/G1-Request/Grant:   These pins are utilized by other local bus masters, in themaximum mode, to force the processor to release the loca

DW : Define Word:- The DW directive serves the same purposes as the DB directive, but now it makes the assembler  which reserves thenumber ofmemory words (16-bit) instead of by

which uses BIOS interrupt INT 21 to read current system time and displays it on the top-left corner of screen.

how we can multiply two 8 bit number with rotation

Example : Write a program to move the contents of the memory location 0500H to BX and also to register CX. Add immediate byte 05H to the data residing in memory location, whose ad