/*#########################################################################################################*/ /* lab5drv.c */ /* This is the C Driver Program for the Factorial Function */ /* If you input a number it will print the Factorial of that number. */ /* Note: global_var is the global variable and num is a variable local to main */ /* You will need to use the stack for the local variable local_var of the function Fact(). */ /* Please try the program for inputs <= 16. Program fails for inputs greater than 16 as a result of */ /* large size of the result. /*########################################################################################################*/ #include "stdio.h" int main(void); void Fact(void); int global_var; // This is the global variable int main(void){ int num; printf("Please Enter a Number:\n"); scanf("%d",&num); global_var=num; Fact(); if (global_var==-1) // In case the input is negative, this check will take care of negative inputs printf("Invalid Input\n"); else printf("The Factorial is %d \n",global_var); }