有个小问题,请看看问题在哪?
#include <stdio.h>void main()
{
int x1,x2,x3,x4,x5;
float average;
average=(x1+x2+x3+x4+x5)/5.0;
printf("Enter x1,x2,x3,x4,x5");
scanf("%d%d%d%d%d",&x1,&x2,&x3,&x4,&x5);
printf("average=%f\n",average);
}
这个程序运行结果总不对?
root@~ #cat 1.c #include <stdio.h> int main (void) { int x1,x2,x3,x4,x5; float average; printf ("Enter x1,x2,x3,x4,x5:"); scanf ("%i%i%i%i%i",&x1,&x2,&x3,&x4,&x5); average=(x1+x2+x3+x4+x5)/5.0; printf ("average=%f\n",average); return 0; }