#include /* Example program provided by Dr. Christie Ezeife */ /* The simple program finds the sum of any two given integer numbers using one function with only global variables used by main. */ /* We declare the global variables here */ int Num1, Num2, Sum; /* I declare the function prototype here */ void FindSum(void); int main(void) { printf("Type the two numbers to add: e.g. 45 20 \t:"); scanf("%d %d", &Num1, &Num2); /* Here, I should call the function FindSum to get the Sum */ /* Note the function uses the global variables, */ /* Num1, Num2 and Sum and is called without parameters. */ FindSum(); printf("%d + %d = %d \n", Num1, Num2, Sum); return 0; } /* end of Main */ /* Now, I should define the function FindSum, which has no */ /* formal parameters. */ void FindSum(void) { Sum = Num1 + Num2; } /* end of function definition for FindSum */