/* Example 3.2: Better exchange kiosk Course: IS 0015 Author: Peter Brusilovsky This program calculates the amount of dollars received in an exchange kiosk for the given amount in German marks */ #include main() { float dollars_for_mark = 0.55; /* exchange rate */ int comission = 3; /* comission in dollars */ int marks; float dollars; /* get data */ printf("Marks to exchange?: "); scanf("%d",&marks); /* calculate USD */ dollars = marks * dollars_for_mark - comission; /* 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); }