Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

BNF

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

What is a verb?

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago