I keep looking at this code, and cant find out the problem...
I made this as part of a library of math functions. It asks the user to enter the number of numbers to subtract, then enter them. It should work, but for some reason doesn't.
void sub()
{
int nums=0;
int trks=0;
int alnms[500];
int ttls=0;
int trkss = 1;
printf("\n\nHow many numbers to subtract?\n");
scanf("%d", &nums);
printf("\nEnter the numbers on each line\n");
do
{
trks++;
scanf("%d", &alnms[trks]);
}
while (trks<nums);
trks=0;
ttls=alnms[1];
do
{
trks++;
trkss++;
ttls = ttls-alnms[trkss];
}
while (trks<nums);
printf("\n\nThe total is: %d\n\n", ttls);
}