#include <stdio.h>
int main()
{
double num = 2.5;
int num1 = (int)num;
printf("num的整数部分是%f\n", num);
printf("num1的整数部分是%d\n", num1);
return 0;
}
#include <stdio.h>
int main()
{
double num = 2.5;
int a =(int)num; //定义浮点型变量num并赋值为2.5
printf("num的整数部分是%d\n", a);
return 0;
}
#include <stdio.h>
int main()
{
double num = 2.5;
printf("num的整数部分是%d\n",(int)num);
return 0;
}