
-----------------------------------
The Rookie
Sat Oct 12, 2013 9:54 am

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.



%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

-----------------------------------
Nathan4102
Sat Oct 12, 2013 10:41 am

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.

put sqrt(9)
%Outputs 3

-----------------------------------
Raknarg
Sat Oct 12, 2013 12:43 pm

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
Sat Mar 12, 2016 1:13 pm

RE:Turing Calculator (Simple)
-----------------------------------
Made a tutorial!

https://www.youtube.com/watch?v=pkGDWe3nReQ&index=3&list=PLs9jD_F5glNZOnJnHazosDUFENaXbv_vy
