Turing Calculator (Simple)
Author |
Message |
The Rookie
|
Posted: Sat Oct 12, 2013 9:54 am Post subject: Turing Calculator (Simple) |
|
|
What is it you are trying to achieve?
Turing Calculator Square Roots
What is the problem you are having?
How would I add square roots to the code?
Describe what you have tried to solve this problem
I have tried to search elsewhere but the answers were not helpful.
Turing: |
%Variables
var num, num2 : real
%Questions
color(purple)
put "Program by Mishil Desai."
put "This calculator works by entering 2 numbers. The results will then be displayed."
loop
color(black)
put "================================================================================"
put "Enter first number:"
get num
put "Enter second number:"
get num2
%Outcomes
color(blue)
put "________________________________________________________________________________"
put "________________________________________________________________________________"
put "Added = ", num + num2
put "Substracted (First - Second) = ", num - num2
put "Substracted (Second - First) = ", num2 - num
put "Multiplied = ", num * num2
put "Divided (First / Last) = ", num / num2
put "Divided (Last / First) = ", num2 / num
put ""
end loop
%Program by Mishil Desai
|
Please specify what version of Turing you are using
Turing 4.1.1 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Nathan4102
|
Posted: Sat Oct 12, 2013 10:41 am Post subject: RE:Turing Calculator (Simple) |
|
|
Are you trying to square the sum of the numbers? The difference? The single numbers?
The sqrt(number : real) function is what you're looking for.
|
|
|
|
|
|
Raknarg
|
Posted: Sat Oct 12, 2013 12:43 pm Post subject: RE:Turing Calculator (Simple) |
|
|
You can use the predefined sqrt or you can use exponents. For example:
4 ** 2 = 16
16 ** (0.5) = 4
Just use two stars as opposed to one |
|
|
|
|
|
MasterCard
|
|
|
|
|
|
|