Incrementing value of i; Why doesn't it work?!?

Hey can somebody please tell me where I have done the dummy mistake and why it doesn’t work?

It alway gives out zeros for both x and y in the serial print.

int i;
int x;
int y;
void setup() {

Serial.begin(9600);


}
void loop() {
  
for (i=0; i < 2*PI; i++);
 

 x = sin(i);
 y = cos(i);
 
 
 Serial.print("x = ");     
 Serial.print(y);
 Serial.print("\t y = ");
 Serial.println(y);

 delay(20);    

}

Trigonometric values are not integers.

And your printing y twice and not printing x at all.

Mark

do not put a semicolon after the if for()

Moderator edit: Correction

sin and cosine are always less than one, so if you round the float answer to an integer, you will always get zero.

Do put some braces after the "for"

I cleaned it up a bit, it was fun to do…

// Trig Test

int d;    // degrees
float r;  // radians
float s;
float c;
void setup() {

  Serial.begin(9600);


}
void loop() {

  for (d = 0; d <= 360; d += 10) {    // step by 10 to cut down the clutter and see the functions

    r = d * PI / 180 ;   //convert degrees to rad for Arduino trig funtions
    s = sin(r);
    c = cos(r);

    Serial.print(" deg = ");
    Serial.print(d);
    Serial.print("\t sin = ");
    Serial.print(s, 4);             // ,4  is 4 decimal places
    Serial.print("\t   cos= ");
    Serial.println(c, 4);

    delay(100);           // lets you see it work...

  }
  Serial.println();      // throws a blank line at the end
  Serial.end();          // kills output after 1 cycle
}