Calculate discount value

Write a program to Calculate discount value.

C Program

#include <stdio.h>
int main()
{
    float amount;
    float discount;

    printf("Enter the original amount : ");
    scanf("%f", &amount);

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

    float final = amount - amount * discount / 100;

    float discountAmount = amount * discount / 100;
    printf("Final price is %f\n"final);
    printf("Discount amount is %f"discountAmount);

    return 0;
}
Input:
Enter the original amount : 34593
Enter dicount percentage : 12.5

Output:

Final price is 30268.875000
Discount amount is 4324.125000


No comments:

Post a Comment