Public feed #376625

Stuff

public text v1 · immutable
Raw Edit
·published 2007-03-01 04:20 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>
/* lab5 */

void makeHeader(FILE *outfile, char *title);
void finish(FILE *outfile);
 
int main() 
{
	FILE *out;
	int i, j; // for the factor table
	if ((out = fopen("myWebPage.html", "w")) == NULL) {
		printf("Error Opening myWebPage.html");
		exit(1);
	}
	makeHeader(out, "Factors");

	for(i = 1; i <= 16; i++) {
		fprintf(out, "%d| ", i);
		for(j = 1; j <= i; j++) {
			if((i % j) == 0) {
				fprintf(out, "%d ", j);
			}

		}
		fprintf(out,"<br>\n");
	}

	finish(out);
	fclose(out);
        return 0;
}
void makeHeader(FILE *outfile, char *title) {
	fprintf(outfile, "<html>\n<head>\n"); /* write the html */
	fprintf(outfile, "<title> %s </title>\n", title);  
	fprintf(outfile, "</head>\n<body>\n");
}
void finish(FILE *outfile) {
	fprintf(outfile, "</body>\n</html>\n");
}