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
Get step-by-step solutions from verified subject matter experts
