#include <stdio.h>
int main ( void )
{
float value1; /* floating point value to read */
float value2; /* another floating point value to read */
char answer; /* To determine if more input is available */
char myOperator; /* The operator to run against our two input values */
/* process expressions until the user types a 'n' when prompted */
do
{
printf ( "\n Type in your expression.\n " ) ;
scanf ( "%f %c %f" , & value1, & myOperator, & value2) ;
/* process our two values based on the operator specified */
if ( myOperator == '+' )
printf ( "%.2f\n " , value1 + value2) ;
else if ( myOperator == '-' )
printf ( "%.2f\n " , value1 - value2) ;
else if ( myOperator == '*' )
printf ( "%.2f\n " , value1 * value2) ;
else if ( myOperator == '/' )
printf ( "%.2f\n " , value1 / value2) ;
printf ( "\n Would you like to enter another expression? (y/n) " ) ;
scanf ( " %c" , & answer) ;
} while ( answer ! = 'n' ) ;
printf ( "\n Goodbye" ) ;
return 0 ;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CmludCBtYWluICh2b2lkKQp7ICAgCgogICAgZmxvYXQgdmFsdWUxOyAgIC8qIGZsb2F0aW5nIHBvaW50IHZhbHVlIHRvIHJlYWQgICAgICAgICAgICAgICovCiAgICBmbG9hdCB2YWx1ZTI7ICAgLyogYW5vdGhlciBmbG9hdGluZyBwb2ludCB2YWx1ZSB0byByZWFkICovCgogICAgY2hhciBhbnN3ZXI7ICAgICAgLyogVG8gZGV0ZXJtaW5lIGlmIG1vcmUgaW5wdXQgaXMgYXZhaWxhYmxlICovCiAgICBjaGFyIG15T3BlcmF0b3I7ICAvKiBUaGUgb3BlcmF0b3IgdG8gcnVuIGFnYWluc3Qgb3VyIHR3byBpbnB1dCB2YWx1ZXMgKi8KCiAgICAvKiBwcm9jZXNzIGV4cHJlc3Npb25zIHVudGlsIHRoZSB1c2VyIHR5cGVzIGEgJ24nIHdoZW4gcHJvbXB0ZWQgKi8KICAgIGRvICAgICAKICAgIHsgCiAgICAgICAgcHJpbnRmKCJcblR5cGUgaW4geW91ciBleHByZXNzaW9uLlxuIik7ICAgICAgICAKICAgICAgICBzY2FuZigiJWYgJWMgJWYiLCAmdmFsdWUxLCAmbXlPcGVyYXRvciwgJnZhbHVlMik7CgogICAgICAgIC8qIHByb2Nlc3Mgb3VyIHR3byB2YWx1ZXMgYmFzZWQgb24gdGhlIG9wZXJhdG9yIHNwZWNpZmllZCAqLwogICAgICAgaWYgKCBteU9wZXJhdG9yID09ICcrJyApICAgICAgICAgICAgCiAgICAgICAgICAgcHJpbnRmICgiJS4yZlxuIiwgdmFsdWUxICsgdmFsdWUyKTsgICAgICAgIAogICAgICAgZWxzZSBpZiAoIG15T3BlcmF0b3IgPT0gJy0nICkgICAgICAgICAgIAogICAgICAgICAgIHByaW50ZiAoIiUuMmZcbiIsIHZhbHVlMSAtIHZhbHVlMik7ICAgICAgICAKICAgICAgIGVsc2UgaWYgKCBteU9wZXJhdG9yID09ICcqJyApICAgICAgICAgICAgCiAgICAgICAgICAgcHJpbnRmICgiJS4yZlxuIiwgdmFsdWUxICogdmFsdWUyKTsgICAgICAgIAogICAgICAgZWxzZSBpZiAoIG15T3BlcmF0b3IgPT0gJy8nICkgICAgICAgICAgICAKICAgICAgICAgICBwcmludGYgKCIlLjJmXG4iLCB2YWx1ZTEgLyB2YWx1ZTIpOwogICAgICAgIAogICAgICAgcHJpbnRmKCJcbldvdWxkIHlvdSBsaWtlIHRvIGVudGVyIGFub3RoZXIgZXhwcmVzc2lvbj8gKHkvbikgIik7ICAgICAgICAKICAgICAgIHNjYW5mICgiICVjIiwgJmFuc3dlcik7ICAgIAogICAgICAgCiAgICB9IHdoaWxlICggYW5zd2VyICE9ICduJyApOwoKICAgIHByaW50ZigiXG5Hb29kYnllIik7CgogICAgcmV0dXJuIDA7Cn0=