# C Programming language

Let's Compute the Program

In this section we are going to provide The following program computes a table of the sine function for angles between 0 and 360 degrees Example.

 Previous Home Next

## Let's Compute the Program

The following program computes a table of the sine function for angles between 0 and 360 degrees.

```#include < stdio.h>
#include < math.h>
void main()
{
int angle_degree;
// Print a message
printf ("\nCompute a table of the sine function\n\n");
// obtain pi
pi = 4.0*atan(1.0);
printf ( " Value of PI = %f \n\n", pi );
printf ( " angle Sine \n" );
angle_degree=0;
// initial angle value
// scan over angle
while ( angle_degree <= 360 )
// loop until angle_degree > 360
{
printf ( " %3d %f \n ", angle_degree, value );
angle_degree = angle_degree + 10;
// increment the loop index}
}
```

We will learn basic calculations and we learn how we can use deferent methods of deferent library header files in this example .Basically we are calculating the sine values from 0 to 360.Before exampling this example first you must know types of different variable.

### C uses the following standard variable types:

```
int -> integer variable
short -> short integer
long -> long integer
float -> single precision real (floating point) variable
double -> double precision real (floating point) variable
char -> character variable (single byte)

```

The compilers checks for consistency in the types of all variables used in any code. This feature is intended to prevent mistakes, in particular in mistyping variable names. Calculations done in the math library routines are usually done in double precision arithmetic (64 bits on most workstations). The actual number of bytes used in the internal storage of these data types depends on the machine being used.

The printf function can be instructed to print integers, floats and strings properly. The general syntax is:

```
printf( "format", variables );

```

where "format" specifies the conversation specification and variables is a list of quantities to print. Some useful formats are:

```
%.nd integer (optional n = number of columns; if
%m.nf float or
double
(optional m = number of columns,n = number of decimal places)
%ns string (optional n = number of columns)
%c character
\n \t to introduce new
line or tab
\g ring the bell (``beep''
) on the terminal.

```

### Example descriptions

```#include < stdio.h>