C program to calculate stocks