- 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
9 Réponses
+ 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
+ 6
for(int i=0;i<3;++i)
{ cin>>totalprice;
cout<<totalprice*0.15;}
+ 5
Abhishek Wlcm.
+ 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😔
+ 3
#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
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.
0
C++
0
Thank you so much
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;
}