Expressions and Conditional Statements (BILL AMOUNT) ID-3452

Bill amount Settlement in pharmaceutical company (Id-3452)
A pharmaceutical company gives a 2% discount if the remaining balance is paid within 10 days of purchase. Given the BillAmount, BuyingDay, PayingDay of a customer, write an alogirthm and C program to print the amount to be paid. Assume that the BuyingDay and PayingDay are in the same month and year. For example, if the Billamount is 100.00, BuyingDay is 12 and PayingDay is 20 then amount to be paid is 98.00. Whereas when the Billamount is 100.00, BuyingDay is 12 and PayingDay is 23 then amount to be paid is 100.00. Print only two decimal places for the amount to be paid.

Note: In C language, to print only two decimal place of a float variable amount the syntax is printf(“%0.2f”,amount);



Input Format

First line contains the BillAmount

Second line contains the BuyingDay

Third line contains the PayingDay



Output Format
Print the amount to be paid with only two decimal places
sol:-C-CODE: 
#include<stdio.h>
int main()
{
    float a,b,c;
    scanf("%f",&a);
    scanf("%f",&b);
    scanf("%f",&c);
    if(c<=b+10)
    {
        printf("%.2f",a-(2*a/100));
    }
    else
    {
        printf("%.2f",a);
    }
}

Post a Comment

0 Comments