# How to do a simple "1 - 2 + 3 \* 4 / 2"

**URL:** <https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664>\
**Category:** Questions about Thunkable X\
**Created:** [February 1, 2023, 2:26am UTC](https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664 "2023-02-01T02:26:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)\
**Post date:** [February 1, 2023, 2:26am UTC](https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664/1 "2023-02-01T02:26:26Z")

</div>

[https://x.thunkable.com/copy/d33133508cec6445f1c1efe4a0ecf0bc](https://x.thunkable.com/copy/d33133508cec6445f1c1efe4a0ecf0bc)  
If I copy and paste the above math problem to a calculator it gives out the answer as 4. I want to do the same thing in Thunkable. The numbers can be multi digits and the operators occurrence is random. I sat on this problem for couple of hour pondering … I can conceive the solution but it is too big and convoluted. Please check my starter program which can successfully do "123 + 234 + " kind of string. It will just add 123 +234 and spit out the answer as 357 going beyond that is my hurdle. Is there a easy solution or the big bulky convoluted solution I am thinking off is the only way out? Thanks

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 1, 2023, 3:39am UTC](https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664/2 "2023-02-01T03:39:03Z")

</div>

The answer should be 5. What calculator is giving you 4 as the answer?

Given 1 - 2 + 3 \* 4 / 2, you multiply 3 \* 4 / 2 and get 6 (either 12 ÷ 2 or 3 \* 2). So 1 minus 2 is -1 and then adding 6 (from earlier) gives you 5.

If you’re trying to make a calculator app (and I would wonder why…), no there’s no easy solution. It’s going to take a lot of work to get it right.

---

<div class="post-metadata">

**Author:** ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)\
**Post date:** [February 1, 2023, 3:58am UTC](https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664/3 "2023-02-01T03:58:41Z")

</div>

☹ Ok that is what I thought but thanks for confirming it. Now I can skip this feature without guilt 🙂 This is something like a calculator but with limited features for a different purpose. So I will just skip this feature. Just to complete my reply I used the standard calculator which comes with Windows 11.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/0/b01e08c84b9ad59a751c39e5fbbab5364f0c6f91.png)  
There they do the calculations from left to right. 1-2 = -1, -1 + 3 = 2, 2\*4 = 8 and finally 8/2 = 4. You can see the last operation up there above 4. Thanks again

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 1, 2023, 4:14am UTC](https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664/4 "2023-02-01T04:14:40Z")

</div>

> [@anandavardhana57zwwl](#):
>
> There they do the calculations from left to right. 1-2 = -1, -1 + 3 = 2, 2\*4 = 8 and finally 8/2 = 4. You can see the last operation up there above 4. Thanks again

You’re welcome. If that’s true, then the Windows calculator isn’t following [order or operations](https://www.mathsisfun.com/operation-order-pemdas.html). That would really surprise me so I’m guessing you’re entering the problem from left to right and that actually, _you_ are ignoring order of operations.

If you do need to program a calculator, there are many examples available if you Google _calculator Thunkable_.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [April 24, 2023, 7:05pm UTC](https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664/5 "2023-04-24T19:05:02Z")

</div>

Actually there are two types of order processing in calculators, the accounting type which is FCFS (First Come First Serve) or the scientific type which is BODMAS. @tatiang is referring to the more common in schools which is BODMAS. Whereas the Windows one is set as accounting type.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [April 24, 2023, 7:45pm UTC](https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664/6 "2023-04-24T19:45:19Z")

</div>

Thanks, I wasn’t aware of the difference.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [July 23, 2023, 7:46pm UTC](https://community.thunkable.com/t/how-to-do-a-simple-1-2-3-4-2/2251664/7 "2023-07-23T19:46:10Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
