Answer to Question #215361 in C for tushar

Question #215361

Mr. Seth is a Goldsmith. He wants to know the amount of money earned from the sale.

On a Normal day, i.e., Weekday there is a sale of Rs. 10000/- which is fixed. On a weekend, there is an additional sale of Rs. 5000/- , and on a festival day (be it either week day or week end), there is an additional sale of Rs. 20000/-.

Following are requirements to solve the problem

a. The type of day i.e., weekend or festival day has to be captured.

b. Check for the type of day and compute the total amount of sale

c. Display the amount of sale in Rupees.



1
Expert's answer
2021-07-09T00:28:03-0400
#include <stdio.h>




int main() {
	char answer;
	//On a Normal day, i.e., Weekday there is a sale of Rs. 10000/- which is fixed.
	int amountSale = 10000;
	//On a weekend, there is an additional sale of Rs. 5000
	printf("Is it a weekend day? (Y/N): ");
	scanf("%c", &answer);
	//Check for the type of day and compute the total amount of sale
	if(answer=='Y'|| answer == 'y'){
		amountSale += 5000;
	}
	// on a festival day (be it either week day or week end), there is an additional sale of Rs. 20000
	printf("Is it a festival day? (Y/N): ");
	scanf(" %c", &answer);
	if(answer=='Y'|| answer == 'y'){
		amountSale += 20000;
	}
	// Display the amount of sale in Rupees.
	printf("The amount of sale: Rs. %d",amountSale);


	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