During a promotion operation, a hardware component store applies a 10% discount on all components. Write a program that reads the price of a component on the keyboard and displays the calculated price taking into account the discount.


Difficulty level
This exercise is mostly suitable for students
#include <stdio.h>

int main()
{
    double price;
    printf("Enter the price: ");
    scanf("%lf", &price);
    
    printf("Price before discount: %lf\n", price);
    price -= price *10 / 100;
    printf("Price after discount: %lf\n", price);
    
    return 0;
}

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Maximum of 2 integers