Question

A variety of 15 percent of discount on sales of totaling $300 or more. Write the...

A variety of 15 percent of discount on sales of totaling $300 or more. Write the program by using functions in c programming that request the cost of 3 items and print the amount the coustmer must have to pay.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

double getFinalCost(double cost){
    if(cost >= 300){
        cost = (cost*75)/100;
    }
    return cost;
}

int main(){
   double cost, total = 0;
   
   printf("Enter first item cost: ");
   scanf("%lf",&cost);
   total += cost;
   
   printf("Enter second item cost: ");
   scanf("%lf",&cost);
   total += cost;
   
   printf("Enter third item cost: ");
   scanf("%lf",&cost);
   total += cost;
   
   printf("coustmer must have to pay: %lf\n",getFinalCost(total));
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
A variety of 15 percent of discount on sales of totaling $300 or more. Write the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT