Question

In: Computer Science

Bibi loves to go shopping. One day, one of her favorite stores is offering a discount....

Bibi loves to go shopping. One day, one of her favorite stores is offering a discount. Bibi becomes very interested and decided to shop there. If Bibi’s current total is N Rupiah before X% discount and Y % tax, how much should Bibi pay to the cashier?

Format Input :

A single line with three integers N , X and Y .

Format Output :

A single line of the amount of money Bibi has to pay in two decimal places.

  Constraints :

  • 103 N 109
  • 1 X, Y 100

  Sample Input 1 :

10000 10 10

Sample Output 1 :

9900.00

Sample Input 2 :

90000 5 15

Sample Output 2 :

98325.00

  Sample Input 3 :

43250 7 10

  Sample Output 3 :

44244.75

  Explanation :

  On the first sample, the price of the item after a 10% discount is 9000.00. After discounting the price, we apply a 10% tax on top of it so Bibi owes the cashier 9900.00.

NOTES :

IN C LANGUAGE

  

Solutions

Expert Solution

I have uploaded the Images of the code, Typed code and Output of the Code. I have provided explanation using comments(read them for better understanding).

Images of the Code:


Note: If the below code is missing indentation please refer code Images

Typed Code:

/*Header files*/
#include <stdio.h>
#include <math.h>
int main()
{
/*declaring double and int variables*/
double p;
int d,t;
/*getting inputs from the user
price, discount, tax*/
printf("Enter Price of the item: ");
scanf("%lf",&p);
printf("Enter discount of the item: ");
scanf("%d",&d);
printf("Enter tax of the item: ");
scanf("%d",&t);
/*if price greater than or equal to pow(10,3) and
less than or equal to pow(10,9)*/
if(p>=pow(10,3) && p<=pow(10,9))
{
/*if discount and tax greater than or equal to 1 and
less than or equal to 100*/
if((d>=1 && d<=100)&&(t>=1 && t<=100))
{
/*finding discount using formula
(discount percentage*price)/100*/
double a = (d*p)/100;
/*subtracting discount from price*/
p = p-a;
/*finding tax using formula
(tax percentage*price)/100*/
double b = (t*p)/100;
/*adding tax to price*/
p = p+b;
/*printing the final price*/
printf("Bibi pay to the cashier : %.2lf",p);
}
/*if the given conditions fails*/
else
{
/*printing that the discount or tax is not in the given range*/
printf("Enter discount or tax in given range");
}
  
}
/*if the given conditions fails*/
else
{
/*printing that the price is not in the given range*/
printf("Enter price in given range");
}

return 0;
}
/*code ended here*/

Output:


If You Have Any Doubts. Please Ask Using Comments.

Have A Great Day!


Related Solutions

One of the most successful discount department stores in America is known as Wal-Mart stores and...
One of the most successful discount department stores in America is known as Wal-Mart stores and is named after its founder Sam Walton. Because of the phenomenal success of these stores, Sam Walton became one of the richest men in America. Also, because of his leadership, the stores have enjoyed continuous growth and expansion, so that by mid 1980s, the chain had over 700 stores and was increasing at the rate of an additional 100 stores per year. Its sales...
Pick one of your favorite retail stores and describe the supply chain used to stock inventory...
Pick one of your favorite retail stores and describe the supply chain used to stock inventory in the store. (Hint: there is usually more than one intermediary) Objective: 1. Name and describe the retail store 2. Describe the supply chain intermediaries 3. Do you think this is the most effecient model? Why or why not?
Black Friday – the day after Thanksgiving represents one of the biggest shopping days and marks...
Black Friday – the day after Thanksgiving represents one of the biggest shopping days and marks the first official day of Christmas shopping. However, in 2018 sales on this day were 9% lower than the previous year and represent a trend in the retail market – revenues of departmental stores have either remained stagnant or declined (Macy’s stores revenues between 2008 and 2018 stayed stagnant around $26B and JC Penny actually experienced a decline during the same period from $20B...
The Job Description Based on her review of the stores, Jennifer concluded that one of the...
The Job Description Based on her review of the stores, Jennifer concluded that one of the first matters she had to attend to involved developing job descriptions for her store managers. As Jennifer tells it, her lessons regarding job descriptions in her basic management and HR management courses were insufficient to convince her of the pivotal role job descriptions actually play in the smooth functioning of an enterprise. Many times, during her first few weeks on the job, Jennifer found...
Stephanie was working late one day when her boss approached her and asked her to sign...
Stephanie was working late one day when her boss approached her and asked her to sign an agreement not to compete with her firm. The non-compete clause only applied to a reasonable period of time and prohibited a reasonable scope of activities. Stephanie was given a choice of whether or not she wanted to sign it. There was no benefit to signing it her boss said. Her boss felt the whole exercise was silly and he put no pressure on...
Amber goes to workout one day and is so into her music that she continues her...
Amber goes to workout one day and is so into her music that she continues her workout for 1 hour without taking a break, leading to extreme muscle fatigue and she can not continue. The next day Amber goes to workout and takes two 15 minute breaks to talk to her friends which allows her to complete a full 2 hour workout. 1. Why was Amber able to work out for a longer amount of time when she took the...
A person could go to a bank one day and have excellent service, and then return...
A person could go to a bank one day and have excellent service, and then return the next day and have a poor experience. This part discusses the special issues concerning the marketing of services. Explain the Four unique characteristics of services and give Four strategies to overcome each characteristic.
One day the weather was really bad. Rain and thunderstorms. Yet, the Colonel wanted to go...
One day the weather was really bad. Rain and thunderstorms. Yet, the Colonel wanted to go flying. He went out to the helicopter and got in with a Warrant Officer pilot. Everyone watched as the helicopter picked up to a hover then landed, picked up to a hover then landed. This happened five times. Finally, the aircraft landed and the Colonel walked away. When the pilot got back to operations everyone asked what happened. The pilot said, “When the aircraft...
Oliver likes to go fishing in the river by his house. One day he noticed that...
Oliver likes to go fishing in the river by his house. One day he noticed that there was a white substance on some rocks at the bottom of the river. When he looked closely, it appeared as though someone had sprinkled a powder or crystals in the water. Moreover, the substance was found mainly where a small creek joined the larger river. Curious, Oliver followed the creek through the forest toward an industrial area. Eventually, he reached a fence and...
Q66. Two stores (A, B) both sell one product. The sales data for each day is...
Q66. Two stores (A, B) both sell one product. The sales data for each day is shown in the following table (use variable T for the table). The first column is used to identify the stores (A and B); the 2nd column is the unite price of the product on that day; the 3rd column is the number of sold product on each day. store price Price count A 25 10 A 26 9 B 20 18 … … …...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT