c.ihypress.ca: examples of C programs
Home
> 05. Functions I
The
stars
function: a void function without argument
A function that displays a line of stars on the screen.
The
stars2
function: a void function with one argument
A function that displays a line of stars of variable length depending on a numerical value.
The
stars2
function using a prototype
The same function as before but with a prototype declared at the top of the program.
The
factorial
function: one argument, one result
A function that computes the factorial of an integer number.
The
bigger
function: two arguments, one result
A function that takes in two numbers and returns the largest value of the two.
Prime numbers (by value)
A function that returns 1 if a number is prime and 0 otherwise.
A list of prime numbers
A program displaying the list of all prime numbers between 1 and 1000. It uses the previous function.
Ihypress.ca is online since February 17, 2005.
[
Polycom
|
Caribbean Hotel
|
dj music download
]