-
Notifications
You must be signed in to change notification settings - Fork 0
/
Untitled3.cpp
101 lines (44 loc) · 981 Bytes
/
Untitled3.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <stdio.h>
int main()
{
int a,max=0,c,d,e,sum=0;
float lf,sum1=0.0;
printf("Enter the number of items ");
scanf("%d",&a);
int items[10],min=items[0];
printf("Enter the item's price\n");
for(int i=0;i<a;i++)
{
scanf("%d",&items[i]);
}
for(int i=0;i<a;i++)
{
sum+=items[i];
}
for(int i=0;i<a;i++)
{
max=max>items[i]?max:items[i];
min=items[i]<min?items[i]:min;
}
printf("Enter the loss %% in max and profit %% in min");
scanf("%d%d",&c,&d);
printf("Enter the profit %% in others");
scanf("%d",&e);
lf=(d*min)/100-(c*max)/100 ;
printf(" %f ",lf);
for(int i=0;i<a;i++)
{
if(items[i]!=max || items[i]!=min)
lf+=(e*items[i])/100;
else
continue;
}
sum1=sum+lf;
if(sum1>sum)
printf("Profit on deal %f %d %d %d %f ",lf,max,min,sum,sum1);
else if(lf==0)
printf("no profit no loss");
else
printf("loss on deal %f",lf);
return 0;
}