Why does this output come out correct in Xcode but not GCC?

sorry. here is the whole code:

include <stdio.h>

float avgWeather (float high, float low){ // Function to calculate daily average float result; result = (high + low) /2.0; return result; }

int main (void) { int numDays; // stores the users input for number of days to process float todayHigh, todayLow, result, sum = 0; // variables for daily high, low, and result. Initializing "sum" to 0 char condition; // stores the specified weather condition const int numOfSymbols = 20; // using a constant value of 20 to output symbols that correlate with the daily weather conditions printf("Weather Analyzer\n"); printf("===============\n"); printf("please enter a positive number of days: "); scanf("%d", &numDays); while (numDays <= 0){ printf("enter a postive number: "); // loop to keep prompting the user for a positive number scanf("%d", &numDays); }

do {        // start a do-while loop to prompt the user for input until the specified number of days is reached
    printf("\nEnter today's high: ");
    scanf("%f", &todayHigh);
    printf("Enter today's low: ");
    scanf("%f", &todayLow);
    printf("Enter today's conditions (s: sunny, c: cloudy, p: precipitation): ");
    scanf(" %c", &condition);
    printf("High is %.2f\n", todayHigh);
    printf("Low is %.2f\n", todayLow);
    result = avgWeather(todayHigh, todayLow);
    printf("Today's average temperature is : %.2f degrees\n", result);

    sum = sum + result;     //storing the value of result in the variable sum
    int count;  // declaring a variable named "count" to process the number of days throughout the loop
    count++;    // add 1 for each cycle through the loop

    if (condition == 's'){      // start of loop to output the symbols related to the user specified conditions
        int i = 0;
        while  (i < numOfSymbols)
            printf("@", i++);
    }
    else if (condition == 'c'){
        int x = 0;
        while  (x < numOfSymbols)
            printf("~", x++);

    }
    else if (condition == 'p' ){
        int y = 0;
        while (result >= 0 && y < numOfSymbols)
            printf(";", y++);
        if (result < 0)
        while (y < numOfSymbols)
                printf("*", y++);
    }

    if (numDays == 1){   // once the specified number of days is reached output the avareage for all days
        sum = sum / count;
        printf("\naverage for all %d days is %.2f", count, sum);
    }
}

while (numDays > 0, --numDays);     // end of do-while loop once number of days is reached

return 0;

}

/r/C_Programming Thread Parent