logo image

C Language program to calculate discount

Views: 664

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 <stdio.h>

int main(void) {
	int bill;
	int discount;

	printf("Enter bill amount:");
	scanf("%d", &bill);

	printf("Enter discount percentage:");
	scanf("%d", &discount);

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

	printf("After discount your bill is: %d", afterDiscount);
}

Output:

Enter bill amount: 20000
Enter discount percentage: 10
After discount your bill is: 18000