Answer to Question #213532 in C for Almas

Question #213532

Flipkart is providing a discount to customers based on the purchases made. Ramachandra has purchased some items, he would like to know his bill. Following are the requirements to solve the problem


a) For purchases less than Rs 1000, the discount is 10% b) For purchases greater than and equal to Rs 1000 and less than 1500 the discount is 12%


c) For purchases greater than and equal to Rs 1500 the discount is 14% 4) Capture the purchased amount by Ramachandra


e) Display Ramachandra's final bill


1
Expert's answer
2021-07-04T17:12:05-0400
#include<stdio.h>


int main(){
	float purchasesMade=0;
	float discount=0;
	printf("Enter the purchases made: ");
	scanf("%f",&purchasesMade);
	//a) For purchases less than Rs 1000, the discount is 10% b) 
	if(purchasesMade<1000){
		discount=0.1;
	}
	//For purchases greater than and equal to Rs 1000 and less than 1500 the discount is 12%
	if(purchasesMade>=1000 && purchasesMade<1500){
		discount=0.12;
	}
	//c) For purchases greater than and equal to Rs 1500 the discount is 14% 
	if(purchasesMade>=1500){
		discount=0.14;
	}
	//d) Capture the purchased amount by Ramachandra
	purchasesMade-=purchasesMade*discount;
	//e) Display Ramachandra's final bill


	printf("\nRamachandra's final billed by Ram is: Rs %.2f\n\n",purchasesMade);


	getchar();
	getchar();
	return 0;
}




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!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS