所以,我正在阅读C编程.我预订了这个练习:
Write a program which asks the user to enter a dollars-and-cents amount, then displays the amount with 5% added?
方案:
#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;
}
Run Code Online (Sandbox Code Playgroud)
我知道是什么.3f意思(在...之后应该有3位数字),但是什么1.05f意思?
C89中以下每个表达式的值是多少?(如果表达式可能包含多个值,则给出所有可能的值.)
a) 8/5
My answer 1
b) -8/5
A : -1
c)8/-5
A: -1
d)-8/-5
A:1
e)8 % -5
Answer: output is 3 but why?
Also,are the other answers correct?
Run Code Online (Sandbox Code Playgroud)