36 : C Program to Calculate Discount Amount

Check out the complete list of c-programs : C Program List    

This program calculates the discount amount and the discounted rate for which you get the product for sale.

Variables :

1. price : Datatype float : Actual price of the Product.

2. discount_percentage : Datatype float : Discount % on the Product.

3. discount_amount: Datatype float : Discount Amount on the Product.

4. discounted_price: Datatype float : Discounted price that you pay.

Functions :

printf() : is used to display something on the console/screen. Format specifier %d in printf function is used to display a int variable on screen and %f for float. \n is used to add a newline

scanf() : is used to fetch data inputted by the user on the console/screen using keyboard. %d in scanf is indicates that inputted text is of type int.

Formula :

Discount Amount = (Discount Percentage x Price)/100

Discounted Price = Price - Discount Amount

 * 1000+ C programs + tutorials
 * 36_calculate_discount_amount.c
 *  Created on: Oct 20, 2014
 *  Author: Code2care.org


void main() {

   float price;
   float discount_percentage;
   float discount_amount;
   float discounted_price;

//    clrscr();

    printf("C Program to Calculate Discount Amount :  ");

    printf("\n\n Enter Price of Item  : ");
    scanf("%f", &price);
    printf("\n\n Enter Discount Percentage on Item  : ");
    scanf("%f", &discount_percentage);
    discount_amount = (discount_percentage*price)/100;
    discounted_price = (price-discount_amount);
    printf("\n\nDiscount amount : %f \n\n",  discount_amount);
    printf("Discounted price : %f \n\n",  discounted_price);

//	getch();


The best way to learn C programming is to practice more and more of programs . Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.

BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.