- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- double a,b,c,d,e;
- a = 1.2;
- b = 2.3;
- c = 3.4;
- d = 4.5;
- e = a + b + c + d;
- printf("%f\n", e);
- system("pause");
- return 0;
- }
复制代码
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- double f,g,h;
- f = 1.1;
- g = 100;
- h = f * g;
- printf("%f\n", h);
- system("pause");
- return 0;
- }
复制代码
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- double i,j,k;
- i = 10.1;
- j = 10;
- k = i * (j * j);
- printf("%f\n", k);
- system("pause");
- return 0;
- }
复制代码
熟练的写法
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- printf("%f\n", 1.2+2.3+3.4+4.5);
- printf("%f\n", 1.1*100);
- printf("%f\n", 10.1*10*10);
- system("pause");
- return 0;
- }
复制代码 |