Question: Using BNF or EBNF description, write the grammar rules for this programming language. //The program finds the quotient and remainder of two given positive integers,

Using BNF or EBNF description, write the grammar rules for this programming language.

//The program finds the quotient and remainder of two given positive integers, num // and denom.

main

begin

int num, denom, quot, rem;

read num, denom;

if (denom = 0)

then {write ( the denominator has an invalid value 0!);}

else { rem := num; quot := 0;

while rem denom do

{rem := rem denom;

quot := quot + 1;

};

write (quotient =, quot);

write (remainder =, rem);

};

end

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!