potentiometer to control motor speed

Hi,
I am new to programming and I am experimenting with sensors and programming them with easyC v4.

I want to control a motors speed with a potentiometer.

This is what I have so far as I understand how it would work, but it is not working…

#include "Main.h"
void main ( void )
{
int pot;
float percent;
float motorSpeed;
while ( 1 )
{
pot = GetAnalogInput ( 8 ) ;
PrintToScreen ( "pot value: %d\n" , pot ) ;
percent = pot / 1024 ;
motorSpeed = percent * 127 ;
SetMotor ( 1 , motorSpeed ) ;
}
}

I don’t know what else to do to get it to work. HELP!?!

I figured it out…

I made all of my variables float variables and it did what i wanted it to do.