小编Not*_*ing的帖子

C编程浮点数?

所以,我正在阅读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意思?

c floating-point

1
推荐指数
1
解决办法
1030
查看次数

C编程找到C89的输出?

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)

c

-4
推荐指数
1
解决办法
302
查看次数

标签 统计

c ×2

floating-point ×1