- # include <stdio.h>
- void main()
- {
- /* 定义变量并赋初值 */
- int a = 5;
- char c = 'a';
- float f = 5.3;
- double m = 12.65;
- double result;
- /* 同类型数据间进行运算并输出结果 */
- printf("a + c = %dn", a + c);
- printf("a + c = %cn", a + c);
- printf("f + m = %fn", f + m);
- /* 不同类型数据间进行运算并输出结果 */
- printf("a + m = %fn", a + m);
- printf("c + f = %fn", c + f);
- /* 将上述四个变量进行混合运算,并输出结果 */
- result = a + c * (f + m);
- printf("double = %fn", result);
- }