C语言程序:输入商品信息并显示
#include <stdio.h>
int main() { int id, quantity; char name[50]; float cost_price, selling_price, discount;
printf('请输入商品编号:');
scanf('%d', &id);
printf('请输入商品名称:');
scanf('%s', name);
printf('请输入商品进价:');
scanf('%f', &cost_price);
printf('请输入商品售价:');
scanf('%f', &selling_price);
printf('请输入商品折扣:');
scanf('%f', &discount);
printf('请输入商品数量:');
scanf('%d', &quantity);
printf('
商品编号:%d ', id); printf('商品名称:%s ', name); printf('商品进价:%.2f ', cost_price); printf('商品售价:%.2f ', selling_price); printf('商品折扣:%.2f ', discount); printf('商品数量:%d ', quantity);
return 0;
}
原文地址: https://www.cveoy.top/t/topic/omTT 著作权归作者所有。请勿转载和采集!