print_fact - return 0; } int fact(int m) { /* function to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* print_fact.c * Program to print n and n!, for integers n from 1 to 12. */ #include <stdio.h> #define IMAX 12 int fact(int m); /* function prototype */ int main() { int i; for (i = 0; i <= IMAX; i++) printf("%d %d\n", i, fact(i)); /* print n, n! */
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: return 0; } int fact(int m) { /* function to calculate m factorial */ int i, result; result = 1; for (i = 1; i &lt;= m; i++) result *= i; return result; }...
View Full Document

This note was uploaded on 09/29/2009 for the course COSC 1002 taught by Professor Wheatland during the Three '09 term at University of Sydney.

Ask a homework question - tutors are online