
October 31st, 2012, 12:36 AM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 3
Time spent in forums: 29 m 45 sec
Reputation Power: 0
|
|
|
Loop an If condition until .. ?
Is it possible to have a code that would do my math until the results are between 50 and 200 ?
My equation can go very high and I have to work with either /2 or *2 until I get between those 2 targets. As high as 11 times doing /2 (hence the 11 if)
Could you help me please ?
Code:
switch (choix)
{
case 1:
printf("f: ");
scanf("%lf", &B);
C = A/(1/B);
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
if(C<50) C=2*C;
if(C>200) C=C/2;
printf("t = %.10f \n\n",C);
break;
|