Question: BNF BFN notation def guess : real; def n : real; # Set the input variables guess := 1.0; n := inputReal(); if [ n

BNF

BNF BFN notation def guess : real; def n : real; #Set the input variables guess := 1.0; n := inputReal(); if [

BFN notation

def guess : real; def n : real;

# Set the input variables guess := 1.0; n := inputReal();

if [ n >= 0.0 ] then {

# Continue until the root has been found

while [ abs(guess^2 - n) > 0.01 ] { guess := (n + (n / guess)) / 2; };

# Print the result print("Root is ", guess); };

1. Statement 1.1. There are five types of statements 1 Variable Definition 2) Assignment Statement 3) Conditional Statement 4) Loop Statement 5) A Block of Statements 1.2. Notes . Statements end with a': . A block of statements may be empty 2. Variable Definition 2.1. Example def vi: integer: 2.2. Notes Each variable is defined on its own line There are no initializations * Only the following built-in types are allowed: integer, real, string . Variable names must be all letters (upper or lowercase or any combination) 3. Constants 3.1. Expressions can have constants. 3.2. Examples Integer Examples: 1, 123, 0 Real Examples: 0.12, 1234 String Examples: "Hello World","" 3.3. Notes . We do not recognize escape characters in strings A string can be empty *Real numbers must have digits before and after the decimal point. 4. Expressions 4.1. There are two kinds of expressions, math and boolean. Math expressions are made with constants, other math expressions and math operators. Conditional expressions are made with math expressions and relational operators 4.2. Examples 1. Statement 1.1. There are five types of statements 1 Variable Definition 2) Assignment Statement 3) Conditional Statement 4) Loop Statement 5) A Block of Statements 1.2. Notes . Statements end with a': . A block of statements may be empty 2. Variable Definition 2.1. Example def vi: integer: 2.2. Notes Each variable is defined on its own line There are no initializations * Only the following built-in types are allowed: integer, real, string . Variable names must be all letters (upper or lowercase or any combination) 3. Constants 3.1. Expressions can have constants. 3.2. Examples Integer Examples: 1, 123, 0 Real Examples: 0.12, 1234 String Examples: "Hello World","" 3.3. Notes . We do not recognize escape characters in strings A string can be empty *Real numbers must have digits before and after the decimal point. 4. Expressions 4.1. There are two kinds of expressions, math and boolean. Math expressions are made with constants, other math expressions and math operators. Conditional expressions are made with math expressions and relational operators 4.2. Examples

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!