-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpp ass q12.cpp
48 lines (40 loc) · 1.1 KB
/
cpp ass q12.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*WAP to find billammount with discount. Apply discount in following conditions
1. if price of product is greater than Rs.50 then apply discount 2.5%
2. if price of product is greater than Rs.100 then apply discount 5%
3. if price of product is greater than Rs.200 then apply discount 7%*/
#include<iostream>
#include<string.h>
using namespace std;
void addprice(float price,float discount)
{
}
int main()
{
float price[3]={50,190,300};
float discount;
int i;
for(i=0;i<3;i++)
{
cout<<"\n product price= " <<price[i];
if(price[i]>50&&price[i]<=100)
{
discount=price[i]*0.025;
cout<<"\ntotal discount is "<<discount;
cout<<"\nthe total billamount is "<<price[i]-discount;
}
else if(price[i]>100&&price[i]<=200)
{
discount=price[i]*0.05;
cout<<" \ntotal discount is "<<discount;
cout<<"\nthe total billamount is "<<price[i]-discount;
}
else if(price[i]>200)
{
discount=price[i]*0.07;
cout<<"\ntotal discount is "<<discount;
cout<<"\nthe total billamount is "<<price[i]-discount;
}
else
cout<<" \n amount is invalid";
}
}