# My code printing out the wrong calculation

**URL:** <https://forum.codewithmosh.com/t/my-code-printing-out-the-wrong-calculation/18079>\
**Category:** C++\
**Created:** [February 3, 2023, 3:38pm UTC](https://forum.codewithmosh.com/t/my-code-printing-out-the-wrong-calculation/18079 "2023-02-03T15:38:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![codermamba](https://avatars.discourse-cdn.com/v4/letter/c/bc8723/32.png) [@codermamba](https://forum.codewithmosh.com/u/codermamba)\
**Post date:** [February 3, 2023, 3:38pm UTC](https://forum.codewithmosh.com/t/my-code-printing-out-the-wrong-calculation/18079/1 "2023-02-03T15:38:39Z")

</div>

My code was meant to calculate at the end, everything works perfectly fine just one part

 ![Screenshot (4)](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/3/3e74d50a01b80fbcd6ac568d1ada54b915209667.png)

It was meant to print out ```  
Our remaining budget is: 20351.4

```auto

but it printing out that in the picture. Any help please.
.
```

---

<div class="post-metadata">

**Author:** ![Garrett](https://avatars.discourse-cdn.com/v4/letter/g/3e96dc/32.png) [@Garrett](https://forum.codewithmosh.com/u/Garrett)\
**Post date:** [April 6, 2023, 5:49pm UTC](https://forum.codewithmosh.com/t/my-code-printing-out-the-wrong-calculation/18079/2 "2023-04-06T17:49:54Z")

</div>

I imagine you have solved this, but just in case…  
This is most likely a problem with the formula you used to get that output. When I run into a problem like this that I can’t solve going over it on the screen, I write it down on paper as a column of numbers/variables and then fill in the numbers I expect there and do it by hand.  
If you still seem to get the wrong answer then possibly one of the variables is not evaluating to the number you expect and you have to debug, put a breakpoint at that line and in the watch window see that all the values are what you expect.  
Hope that helps.
