Unable to get the results in Serial monitor

Hello all,

I've uploaded the code to arduino Uno but serial monitor is just displaying value 0 all the time. I'm attaching my code below. Please let me know if there are any errors.

void setup()
{
Serial.begin(9600);
}
void loop()
{
int fs = 400;
float Ts = 1/fs;
const float pi = 3.14;
float deg = 60;
float rad = deg * pi/180;
float Tn;
float Tn1;
float T0;
int deg1 = 30;
float rad1 = deg1 * pi/180;

for (int n=1; n<=6; n++)
{
Tn = sqrt(3)Ts * sin ( nrad - rad1);
Tn1 = sqrt(3)*Ts * sin (rad1 - (n-1)*rad);
T0 = Ts - Tn - Tn1;
Serial.println(Tn);
Serial.println(Tn1);
Serial.println(T0);
}
}

  int fs = 400;
  float Ts = 1/fs;

1 / 400 equals 0 according to integer math. If you don't want it to do integer math, force it to do floating point math:

  int fs = 400;
  float Ts = 1.0/fs;

The first error is that you don't read the rules before post, specially this:

You must define the floating point constants like:

  float deg = 60.0;

this line:

  float Ts = 1/fs;

must be:

  float Ts = 1.0/fs;

This:

  float rad = deg * pi/180;

is better like:

  float rad = deg * pi/180.0;

Ts = 1 / fs;
I'm not sure what the compiler will do, but I think it divides integer '1' by integer '400'. That is '0', and convert it to float, so Ts is 0.0.

I suggest to do everything in float. The loop with 'n' is an integer, but you cast that to a float with: (float) n

(While I was typing this, Arrch and luisilva wrote the same)

Peter_n:
(...)
(While I was typing this, Arrch and luisilva wrote the same)

The same to me. While I was typing Arrch post his answer.

Thank you all.

I have one more question. After making the corrections, the output in the serial monitor is limited to two decimal points only. But I need 5-6 decimal points. Is there anything that I should do additionally.?

Is there anything that I should do additionally.?

Two things. One, the Serial.print() method that deals with floats takes an optional second argument to define the number of digits after the decimal point to print. Two, you need to adjust your expectations. 5 or 6 decimal places on an Arduino is unrealistic.