logo image

C++ program to calculate discount

Views: 962

Following program shows you how to calculate discount. In this program we get bill amount and discount from user and shows after discount amount using following formula Discount = bill - (bill * discount / 100)

#include <iostream>

int main() {
	int bill;
	int discount;

	std::cout << "Enter bill amount:";
	std::cin >> bill;

	std::cout << "Enter discount percentage:";
	std::cin >> discount;

	int afterDiscount = bill - (bill * discount / 100);

	std::cout << "After discount your bill is: " << afterDiscount;
}

Output:

Enter bill amount: 1500
Enter discount percentage: 15
After discount your bill is: 1275