请用简洁的c语言输入两个实数,将其整数部分交换后输出,结果保留2位小数
时间: 2024-05-09 18:19:03 浏览: 86
数据输入-C语言学习资料
```c
#include <stdio.h>
int main()
{
float a, b;
int int_a, int_b;
scanf("%f %f", &a, &b);
int_a = (int)a;
int_b = (int)b;
a = a - int_a + int_b;
b = b - int_b + int_a;
printf("%.2f %.2f", a, b);
return 0;
}
```
阅读全文