运行成功,输出为0,求大佬解惑
#include<stdio.h>
int main()
{
double num1 = 2.5;
int num2 =(int) num1;
printf("num的整数部分是%d\n",num2);
return 0;
}
#include<stdio.h> int main() { double num1=2.5; int num2=(int)num1; printf("num的整数部分是%d\n",num2); return 0; }
#include<stdio.h> int main() { double num1 = 2.5; int num2 = (int) num1; printf("num的整数部分是%d\n",num2); return 0; }
#include <stdio.h>
int main()
{
double num = 2.5; //定义浮点型变量num并赋值为2.5
int num1 = (int)2.5;
printf("num的整数部分是%d\n", num1);
return 0;
}