0

Can i convert a variable to constant?

For example i enter 2 numbers into nember1 and number2. Then number1*number2=result So here i want to make the number2 constant then put the result into number1 It means. Each time that i press equal. Number2 stay constant but number1 hold the result then multiply it with number2

16th Nov 2018, 10:26 AM
Diako
Diako - avatar
6 Answers
+ 1
So that means it would be like num1 = x; num2 = y; ans = num1 * num2; num1 = ans; . . . Is that what you mean?
17th Nov 2018, 11:34 AM
Zephyr Koo
Zephyr Koo - avatar
0
Good day Diako! Can you elaborate your question a little bit more with example?
16th Nov 2018, 12:57 PM
Zephyr Koo
Zephyr Koo - avatar
0
Sure. Its a calculator. When i enter two numbers as number1 and number2 and then multiply those two numbers and then when i click the equal button it shows me the result and then when i click on the equal button again it put the result into the number1 and multiply it with the number2 which i want it to be conatant
16th Nov 2018, 1:06 PM
Diako
Diako - avatar
0
Each time that i click on the equal button it put the result in number1 then multiply it with number2
16th Nov 2018, 1:06 PM
Diako
Diako - avatar
0
Yes but in that case you wrote. If i write 2*4 the answer is 8 but if i press equal again it would be 64 but i want that be 32
17th Nov 2018, 11:38 AM
Diako
Diako - avatar
0
The calculator automatically comes and make the num2 to result and when you make the num1 to result it will be result * result
17th Nov 2018, 11:38 AM
Diako
Diako - avatar