C语言程序:输入商品信息并显示
#include <stdio.h>
int main() { int code, quantity; float cost_price, selling_price, discount; char name[20];
printf('Enter the product code: ');
scanf('%d', &code);
printf('Enter the product name: ');
scanf('%s', name);
printf('Enter the cost price: ');
scanf('%f', &cost_price);
printf('Enter the selling price: ');
scanf('%f', &selling_price);
printf('Enter the discount: ');
scanf('%f', &discount);
printf('Enter the quantity: ');
scanf('%d', &quantity);
printf('
Product code: %d', code); printf(' Product name: %s', name); printf(' Cost price: %.2f', cost_price); printf(' Selling price: %.2f', selling_price); printf(' Discount: %.2f', discount); printf(' Quantity: %d', quantity);
return 0;
}
原文地址: https://www.cveoy.top/t/topic/omTP 著作权归作者所有。请勿转载和采集!