// ================================================================ // John Kerl // kerl at math dot arizona dot edu // 2008-07-23 // ================================================================ #include // For the printf prototype #include // For the sscanf prototype #include // For the exit prototype #include // For the sin prototype int main(int argc, char ** argv) { int n = 40; int i; float x, y; if (argc == 2) { if (sscanf(argv[1], "n=%d", &n) != 1) { fprintf(stderr, "Usage: %s [n=...]\n", argv[0]); exit(1); } } for (i = 0; i < n; i++) { // Here is a comment. x = (float)i/n * 2.0 * M_PI; y = sin(x); printf("%3d %11.7f %11.7f\n", i, x, y); } return 0; }