C examples for Function:Function Definition
Create function to find the Greatest Common Divisor
#include <stdio.h> void gcd (int u, int v){ int temp;/* w ww . j a v a 2s . com*/ printf ("The gcd of %i and %i is ", u, v); while (v != 0){ temp = u % v; u = v; v = temp; } printf ("%i\n", u); } int main (void) { gcd (10, 5); gcd (20, 40); gcd (80, 240); return 0; }