Define a language for arithmetic expressions that consist of

Define a language for arithmetic expressions that consist of unsigned integer numbers and operators +, -, *, and /. An unsigned integer number consists of any number of digits (0 through 9), but contains no leading zeros. For example, 0, 1, 700, 101, 10 are all acceptable integers, but 00, 01, 0009, 0101 are not. An arithmetic expression consists of any number of unsigned integer numbers connected by the four operators. No parenthesis are used.

With a regular expression for the arithmetic expressions defined above.

Transform the NFA to regular grammar.

Solution

int main(void)
{
unsigned int num = 0x80000000;
printf(\"%%d shows: %d, %%u shows: %u\ \", num, num);
return 0;
}

int first, second, add, subtract, multiply;
float divide;
{

printf(\"Enter two integers\ \");
scanf(\"%d%d\", &first, &second);

add = first + second;
subtract = first - second;
multiply = first * second;
divide = first / (float)second; //typecasting

printf(\"Sum = %d\ \",add);
printf(\"Difference = %d\ \",subtract);
printf(\"Multiplication = %d\ \",multiply);
printf(\"Division = %.2f\ \",divide);

return 0;
}
}

Define a language for arithmetic expressions that consist of unsigned integer numbers and operators +, -, *, and /. An unsigned integer number consists of any n

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site