Variable Problem

Hey guys i am working on a project and in my sketch i have to add two variables to each other like first variable is 85 and the second is 45 i want them to be 8445 how do i do that in my sketch i tried this line but of course it did not please help me thanks

firstvar = firstvar + secondvar;

Hi,
I think you are looking for 8545.

If the variable values you quote are decimal and the secondvar is always 2 digits.

firstvar = (firstvar*100) + secondvar;

Tom... :slight_smile:

But they can be alsı 180 or 2942 waht should i do

You've already posted this question.
The answer is simple, primary school arithmetic (Base - n)
Thread locked.

DO NOT CROSS-POST, CROSS-POSTING WASTES TIME.