C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++

A supermarket has launched a campaign offering a 15% discount on 3 items. Write a program that takes the total price for every purchase as input and outputs the relevant discount. Sample Input 15000 4000 6700 Sample Output 2250 600 1005 Explanation 2250 represents a 15% discount for a 15000 purchase; 600 for 4000 and 1005 for 6700 accordingly. Ik I asked this yesterday still don’t got a answer though.

21st Sep 2021, 12:35 PM
Mando
Mando - avatar
9 Answers
+ 2
Please, firstly show your attempt. After that ask what your problem is. Thanks for understanding. Happy coding!
21st Sep 2021, 12:42 PM
mesarthim
mesarthim - avatar
+ 2
Take 3 respective inputs, calculate their discount by this formula -: 15(15% discount given in question)/100 * each respective item
21st Sep 2021, 12:43 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
Rellot's screwdriver I see now. Thanks!
21st Sep 2021, 12:46 PM
mesarthim
mesarthim - avatar
+ 1
Mando your code has a lot of small errors. learn the C++ course again to get what you're doing.
21st Sep 2021, 12:48 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
Mando It looks you made some syntax error. For example in "totalprice-totalpirce". Check it. Then it must work. I hope, it helps. Happy coding!
21st Sep 2021, 12:48 PM
mesarthim
mesarthim - avatar
+ 1
Try not to post the whole challenge as one question
22nd Sep 2021, 8:06 PM
Sonic
Sonic - avatar
+ 1
Would completing the C++ tutorial help?
22nd Sep 2021, 8:07 PM
Sonic
Sonic - avatar
0
mesarthim #include <iostream> using namespace std; int main() { int purchesAmount = 0; int totalpirce; do{ cout << "totalprice * 0.15"<< endl; } while (purchesAmount/15 ); return 0; }
21st Sep 2021, 12:43 PM
Mando
Mando - avatar
0
mesarthim he did showed his attempt in his yesterday post, he said he asked this yesterday. https://www.sololearn.com/Discuss/2886351/?ref=app
21st Sep 2021, 12:44 PM
Rellot's screwdriver
Rellot's screwdriver - avatar