SOURCE CODE
int mangoKg, mangoPrice, orangeKg, orangePrice, pay, total, change;
Console.Write("Mango(Kg) :");
int mangoKg, mangoPrice, orangeKg, orangePrice, pay, total, change;
Console.Write("Mango(Kg) :");
mangoKg = int.Parse(Console.ReadLine());
Console.Write("Orange Price(Baht/Kg :");
mangoPrice = int.Parse(Console.ReadLine());
Console.Write("Orange(Kg) :");
orangeKg = int.Parse(Console.ReadLine());
Console.Write("Orange Price(Baht/Kg) :");
orangePrice = int.Parse(Console.ReadLine());
total = (mangoPrice * mangoKg) + (orangePrice * orangeKg);
Console.Write("Total :");
Console.WriteLine(total);
Console.Write("Pay(Baht) :");
pay = int.Parse(Console.ReadLine());
change = pay - total;
if (pay >= total)
{
Console.Write("Change :");
Console.WriteLine(change);
}
Console.WriteLine();
แสดงผล
1.กรณีจ่ายเงินพอซื้อ
2.กรณีจ่ายเงินไม่พอซื้อ
ไม่มีความคิดเห็น:
แสดงความคิดเห็น
แสดงความเห็นเกี่ยวกับบทความตรงนี้นะ ^^