of
of
of
of
of
of
i:
j:
k:
x:
y:
z:
5618848
0
6844404
3.98979e-34
9.59105e-39
9.59105e-39
The values printed depend on many factors, so the chance that you'll get exactly
these numbers is small.
5. [was #10] (a) is not legal because 100_bottles begins with a digit.
8. [was #12] There are 14 tokens: a, =, (, 3, *, q, -, p, *, p, ), /, 3, and ;.
Answers to Selected Programming Projects
4. [was #8; modified]
#include <stdio.h>
int main(void)
{
float original_amount, amount_with_tax;
printf("Enter an amount: ");
scanf("%f", &original_amount);
amount_with_tax = original_amount * 1.05f;
printf("With tax added: $%.2f\n", amount_with_tax);
return 0;
}
The amount_with_tax variable is unnecessary. If we remove it, the program is sli
ghtly shorter:
#include <stdio.h>
int main(void)
{
float original_amount;
printf("Enter an amount: ");
scanf("%f", &original_amount);
printf("With tax added: $%.2f\n", original_amount * 1.05f);
return 0;
}