Question #46758

write a programe in which take quantity and rate from users.if total prize is greater then 1000 then 10% discount is offered.find the total amount to pay.
1

Expert's answer

2014-09-24T12:18:31-0400
#include <stdio.h>
int main() {
    int quantity;
    float rate;
    float total;
    // Output/Input
    printf("Quantity: ");
    scanf("%d", &quantity);
    printf("Rate: ");
    scanf("%f", &rate);
    total = quantity * rate;
    // The discount
    if (total > 1000) {
        total *= 0.9;
    }
    printf("The total amount to pay %0.2f", total);
    return 0;
}


Result


quantity: 20
rate: 100
The total amount to pay 1800.00
Process returned 0 < 0x0> execution time : 4.820 s
Press any key to continue.


http://www.AssignmentExpert.com/</stdio.h>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS