blob: 23e7250dbd4c63bbabbad849ed5be996f8522e84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* File: forsin.c
calculate the function sinc(x) = sin(x)/x
for x from -10 to 10 with step size 5 */
#include <stdio.h>
#include <math.h>
int main()
{
int x;
printf("%3c | %5s\n",'x',"sinc(x)");
printf("-------------\n");
for(x=-10;x<=10;x+=5)
{
printf("%3i | %6.3f\n",x,sin(x));
}
return 0;
}
|