Help please!!!

Write your question here.
Hi i need to write a code that gives a percentage of a percentage

ex. 25% discount and once again a 25% discount on merchandise

can anyone help me write this in code form?

can you do this mathematically?
Please Do Not Double Post.

Start by creating a main function and a variable.
Yes Lol
25% of 100 would be 25 = 75
25% of 75 would be 18.75

25 + 18.75 = 43.75
100 - 43.75 = 56.25

if thats what you meant
I know that for one percentage i would just put

price * 50/100;



Stop Posting on both of your posts, Stick to this one. And just edit your post instead of just posting over and over again, thank you :)

Like I said, Start by creating the main function and a variable, and show us that.
Last edited on
write a function percentage(percent,value) and do percentage of a percentage by calling percentage(percent,percentage(percent,value))
Wait so something like this

25/100(price * 25/100);?

and sorry for double posting
Depending on your math...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
double percentage(int p, double v)
{
	return (p*v) / 100;
}
int main() {

	int originalValue = 100;
	//25%
	double p1 = percentage(25, originalValue);
	double balance = originalValue - p1;
	double p2 = percentage(25, balance);
	double p3 = 100 - (p1 + p2);

	cout << p3 << endl;
	system("pause");
	return 0;

}
#include <iostream>
using namespace std;
int main()
{
int option1;
int option2;
int price;


option1 = price * 50/100;
option2 = 25/100 * (price *25/100);
cout << "Please input the price of your merchandise:";
cin >> price;

if (price < 0)
{
cout << "Error!!! Postive Numbers Only!!!" << endl;
}


cout << "Please Choose Option 1 or Option 2:" << endl;
cin >> option1, option2;
}
You pretty much just did this guys homework, without him showing any effort what so ever. Its because of people like you @shadowCODE that people slack off and fail their courses or tests or whatever. Do Not freaking give away shit.
@TarikNeaj, i didnt see any worth giving pointers to a guy who cannot write a function to calculate percentage. I regret it though!
@ShadowCODE then ignore him. He is here becuase he is a slacker, he is asking us to do his homeworks, he is not learning anything by doing that. We dont do other peoples jobs here, we help them with specific problems they encounter. I also hate titles thats like PLEASE HELP HELP PLEASE THIS IS DUE SOON etc etc.

Here OP - https://www.youtube.com/watch?v=tvC1WCdV1XU&list=PLAE85DE8440AA6B83&ab_channel=thenewboston

Bunch of videos explaining shit.

https://www.youtube.com/watch?v=JX14ObbbCPI&list=PL2DD6A625AD033D36&ab_channel=CodingMadeEasy

There aswell. Have at it.
Last edited on
Topic archived. No new replies allowed.