A supermarket has launched a campaign offering a 15% discount on 3 items. Write a program that takes the total price for every | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

A supermarket has launched a campaign offering a 15% discount on 3 items. Write a program that takes the total price for every

Plz help i am beginner use do while

31st Oct 2020, 7:19 AM
Abhishek
9 Answers
+ 7
1.Question incomplete 2.Tag the language in which u wanna code. 3.Where's ur try(code) https://www.sololearn.com/discuss/333866/?ref=app
31st Oct 2020, 7:22 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 6
for(int i=0;i<3;++i) { cin>>totalprice; cout<<totalprice*0.15;}
31st Oct 2020, 7:37 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 5
Abhishek Wlcm.
31st Oct 2020, 7:47 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 3
#include <iostream> using namespace std; int main() { int purchaseAmount = 0; int totalPrice; //your code goes here do{cout <<(totalPrice*15)/100;}while(cin >> totalPrice); return 0; } I know its all wrong😔
31st Oct 2020, 7:33 AM
Abhishek
+ 2
#include <iostream> using namespace std; int main() { float purchaseAmount = 0; float totalPrice; int x = 1; do { cin >> totalPrice ; purchaseAmount = (totalPrice*15)/100; cout << purchaseAmount << endl; x++ ; } while(x <= 3 ); return 0; } Good Luck
25th Jan 2022, 11:39 AM
Muhammad Alif Deva Rizqon
Muhammad Alif Deva Rizqon - avatar
0
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.
31st Oct 2020, 7:25 AM
Abhishek
0
C++
31st Oct 2020, 7:25 AM
Abhishek
0
Thank you so much
31st Oct 2020, 7:46 AM
Abhishek
0
#include <iostream> using namespace std; int main() { int purchaseAmount = 0; double totalPrice; //your code goes here do { cin >> totalPrice; cout << totalPrice * 0.15 << endl; purchaseAmount++; } while (purchaseAmount < 3); return 0; }
29th Jul 2022, 6:39 AM
Neal