CS 220 Parallel Computing

hello-multi.c

DownloadView Raw

/**
 * hello-multi.c
 *
 * Greets the world (multiple times)
 *
 * Input:    None
 * Output:   Several copies of 'Hello world!'
 *
 * Compile:  Using Linux and gcc
 *           gcc -g -Wall hello-multi.c -o hello-multi
 * Run:      ./hello-multi
 */

#include <stdio.h>

void say_hello(int times);

int main(int argc, char *argv[])
{
    say_hello(6);
    return 0;
}

void say_hello(int times)
{
    int i;
    for (i = 1; i <= times; ++i) {
        printf("Hello world! (#%d)\n", i);
    }
}