/* Example: Better exchange kiosk Course: IS 0012 Author: Peter Brusilovsky This program calculates the amount of dollars received in an exchange kiosk for the given amount in German marks */ #include #define DOLLARS_FOR_MARK 0.55 /* exchange rate */ #define COMMISSION 3 /* commission in dollars */ void main() { int marks; float dollars; /* get data */ printf("Marks to exchange?: "); scanf("%d",&marks); /* calculate USD */ dollars = marks * DOLLARS_FOR_MARK - COMMISSION; /* print result */ printf("For %6.2f marks you will get %6.2f dollars!\n" , marks, dollars); /* OOPS! We have tried to print an integer variable marks using %6.2f designed for floats - and printf has printed very strange result */ /* now we print it properly */ printf("For %d marks you will get %6.2f dollars!\n" , marks, dollars); }