输入一个四位数,输出每一位数
#include<stdio.h>#include<math.h>
int main(void)
{
int num,newnum,i;
int digit[4];
printf("Enter a num:");
scanf("%d",&num);
for(i=1;i<=4;i++)
digit[i]=num/pow(10,4-i);
num=num%pow(10,4-i);
printf("%d",digit[i]);
return 0;
}
warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
C:\Documents and Settings\Administrator\桌面\jvb.cpp(12) : error C2297: '%' : illegal, right operand has type 'double'
执行 cl.exe 时出错.
jvb.obj - 1 error(s), 0 warning(s)
求大神指教