|
-
Mar 26th, 2008, 01:40 AM
#1
Thread Starter
New Member
i need a syntax for this program.please!
Assume the following rules of precedence for expressions:
Highest is addition (+)
then subtraction (-)
then multiplication (*)
then division (/)
Evaluate inputs such as:
(a) 1+4*3-2/2 Output: 5*3-2/2 = 5*1/2 = 5/2 = 2.5
(b) 5-2/2+1*2 Output: 5-2/3*2 = 3/3*2 = 3/6 = 0.5
(c) 3-2+4-2+5 Output: 3-6-7 = -3 - 7 = -10
Output up to 5 decimal places if long.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|