#include < stdio.h >
#include < conio.h >
#include < math.h >
#include < stdlib.h >
void main()
{
clrscr();
double
q,s,a=10.0,b=0.9,pl=5.0,c=-2.4,d=1.2,pc;
int flag=0;
printf(" Demand Supply
Price\n\n");
do
{
s=c+d*pl;
q=s;
pc=(a-q)/b;
printf("%f %f %f\n\n",q,s,pc);
if((pc-pl)>100.0|| (pl-pc)>100.0)
flag=1;
if((pc-pl)>0.00001|| (pl-pc)>0.00001)
pl=pc;
else flag=1;
if((pc-pl)>100.0||(pl-pc)>100.0)
flag=1;
}
while (flag==0);
getch();
}
Demand Supply Price
3.600000
3.600000 7.111111
6.133333
6.133333 4.296296
2.755556
2.755556 8.049383
7.259259
7.259259 3.045267
1.254321
1.254321 9.717421
9.260905
9.260905 0.821216
-1.414540
-1.414540 12.682823
12.819387
12.819387 -3.132653
-6.159183
-6.159183 17.954648
19.145577
19.145577 -10.161753
-14.594103
-14.594103 27.326781
30.392138
30.392138 -22.657931
-29.589517
-29.589517 43.988352
50.386022 50.386022
-44.873358
-56.248030
-56.248030 73.608922
No comments:
Post a Comment