c语言,最后程序一直出乱码,这个是最后输出一个表为 price,price值是给了,要求输入units 并接收,可是我不知道哪里错了一直不对

问题描述:

#include<stdio.h>
#include<stdlib.h>
int main()

{

const int NUM = 5;
double prices[] = {9.92, 6.32, 12.63, 5.95, 10.29};
double units[5];
double amounts[5];
double total = 0;
int i;
for (i=0;i<NUM;i++){
    printf("Enter number of units");
    scanf("%d",&units[i]);
    amounts[i] = prices[i] * units[i];
    total = total + amounts[i];

}

printf("Price          Units         Amount\n");

for(i = 0; i < NUM; i++){

    printf("%d %15d %15d\n",prices[i],units[i],amounts[i]); 
}
printf("Total:%d",total);

  system("PAUSE");

return 0;

}

%lf %15d %15d