#include < stdio.h >
#include < conio.h >
#include < math.h >
#include < stdlib.h >
void main()
{
clrscr();
double
q,s,a=12.4,b=1.2,pl=1.0,c=1.0,d=0.9,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)>0.00001|| (pl-pc)>0.00001)
pl=pc;
else flag=1;
}
while (flag==0);
getch();
}
Demand Supply
Price
1.900000
1.900000 8.750000
8.875000 8.875000 2.937500
3.643750
3.643750 7.296875
7.567188
7.567188 4.027344
4.624609
4.624609 6.479492
6.831543
6.831543 4.640381
5.176343
5.176343 6.019714
6.417743
6.417743 4.985214
5.486693
5.486693 5.761089
6.184980 6.184980 5.179183
5.661265
5.661265 5.615613
6.054051
6.054051 5.288290
5.759461
5.759461 5.533782
5.980404
5.980404 5.349663
5.814697
5.814697 5.487752
5.938977
5.938977 5.384186
5.845767
5.845767 5.461861
5.915675 5.915675 5.403604
5.863244
5.863244 5.447297
5.902567
5.902567 5.414527
5.873075
5.873075 5.439104
5.895194
5.895194 5.420672
5.878605
5.878605 5.434496
5.891047
5.891047 5.424128
5.881715
5.881715 5.431904
5.888714 5.888714 5.426072
5.883465
5.883465 5.430446
No comments:
Post a Comment