1. ok so ive changed it, but im getting zero for everything now.. at least i think i fixed what u suggested
Code:
```#include <FPT.h>
int main()
{
double a;
int x,y;
x=inD();
y=inD();
a=0;
while(floor(y/2)==1){

if(fmod(y,2)==0){
a=a+x;
x=x*2;
y=(y/2);

}
else{
x=x*2;
y=(y/2);

}
}
outD(a);

}```

2. Originally Posted by Lucid15
ok so ive changed it, but im getting zero for everything now.. at least i think i fixed what u suggested
Code:
```#include <FPT.h>
int main()
{
double a;
int x,y;
x=inD();
y=inD();
a=0;
while(floor(y/2)==1){

if(fmod(y,2)==0){
a=a+x;
x=x*2;
y=(y/2);

}
else{
x=x*2;
y=(y/2);

}
}
outD(a);

}```
Oh for crying out loud.
Code:
`while(y!=0)`
How hard is this?

3. ok so ive changed everything and NOW IT WORKS! i believe...
Code:
```#include <FPT.h>
int main()
{
double a;
int x,y;
x=inD();
y=inD();
a=0;
while(y!=0){

if(fmod(y,2)!=0){
a=a+x;
x=x*2;
y=(y/2);

}
else{
x=x*2;
y=(y/2);

}
}
outD(a);

}```

4. Sorry for the trouble tabstop, but thank you so much for your help. Im an idiot.

5. Call my crazy but I would probably write this same code as demonstrated bellow.

Or maybe cleaned up to...
Code:
```#include <FPT.h>
int main()
{
double a;
int x,y;
x=inD();
y=inD();
a=0;
while(y!=0){
if(!(y&3)){
a+=x;
x+=x;
y/=2;
}
else{
x+=x;
y/=2;
}
}
outD(a);
}```